change style on hover for element
The element class walkingRoute-container
is between a link tag, and I wonder how to do, to highlight an element with a color that stays when a click is made on the element and removed when a click is made on another element, but not when hover? I would also like to change the <p>
inside the element to another color when hover?
Appreciate some help.
Thanks!
Code is as below
$(document).ready(function(){
$(".walkingRoute-container").hover(
function(){
$(this)开发者_开发知识库.css("background","#02baff");
},
function() {
$(this).css("background","#c1c1c1");
})
});
JQuery function css
also takes parameter like json object.
var obj = {
'height': 100,
'width': 100,
'background', 'red'
};
$(element).css(obj);
精彩评论