Alexander Tepe
Alexander Tepe

Reputation: 190

Javascript change cursor icon to local icon.jpg

I am trying to change my cursor icon in a paint appliation using Javascript. The jpeg icon which I want to use for that purpose is saved locally. Can I use the following line to make this work?

document.body.style.cursor = "server/icon.jpg";

How could I make it work using a url alternatively?

Upvotes: 0

Views: 228

Answers (1)

a--m
a--m

Reputation: 4782

Use the url property instead:

document.body.style.cursor = "url('server/icon.jpg'), auto"

You may want to check MDN for documentation related with cursor css.

Upvotes: 2

Related Questions