Tutorial :Change highlight color


jQuery's highlight method will highlight any div with a yellow background.

How do I specify what color to use instead of yellow for highlight?


According to the documentation:

$(this).effect("highlight", {color: 'blue'}, 3000);  


$("div").click(function () {      $(this).effect("highlight", { color: "#ff0000" }, 3000);  });  

will highlight in red. It's all in the documentation.


FWIW I found that IE8 would give an error in jQuery 1.7.2 usingeffect("highlight",...) when the current color of the element was specified as text or when the highlight color was specified as text (i.e. "blue") instead of in hex notation: "#ff0000".


       $('.divID').live('mouseover mouseout', function (event) {          if (event.type == 'mouseover') {              // do something on mouseover            $(this).css({ "background-color": YOURCOLOR, "opacity": ".50" });            }          else {              // do something on mouseout               $(this).css("opacity", "100");            }        });  

This will give the nice hover effect with opacity looks.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »