-2

I have an element (input) that has this code to give it a background on a small area (like a badge)

jQuery(this).css("background", "url(data:image/png;base64,<BASE64_ENCODED_DATA>) 99% 50% no-repeat scroll rgb(231, 248, 231)");

I want to make it so that when you hover the background the cursor will change to a pointer. Thank you

Alon
  • 5
  • 2

2 Answers2

1
jQuery(this).css({"background":"url(data:image/png;base64,<BASE64_ENCODED_DATA>) 99% 50% no-repeat scroll rgb(231, 248, 231)", "cursor":"pointer"});

or you can write css for that particular div

#particular_div{cursor:pointer;}

Hoping that the background is on body and the .container is the div for content then use

body:not(.container) {cursor:pointer;}
void
  • 36,090
  • 8
  • 62
  • 107
  • This is not what I ment, I want to cursor to change only when the mous is on top of the background image, not the entire element – Alon Feb 11 '15 at 21:49
1

Let the div on which you want the cursor to be changed be #div1. So just change the CSS and use the cursor tag. You don't require JS

#div1{
  cursor:pointer;
}
Dhruv Ramani
  • 2,633
  • 2
  • 22
  • 29