jquery focus problem
Hello all im trying to add a class when i fo开发者_Python百科cus on a small image but it dont add the class, what im doing wrong?
http://jsfiddle.net/6rnU4/
What's wrong with the :hover
pseudo-class?
#small-image img:hover {
border: 5px solid #333;
}
Or
#small-image:hover {
border: 5px solid #333;
}
(depending your intent)
Also, #hover
implies this is a page element with the ID "hover", not an element with the class hover applied. I think you're looking for .hover
Firstly in the latest jquery you need $(document).ready().
Secondly you were overcoding the hide all but first.
And you had missed out the img from your identifier on the add class block, see:
Addition:: Brad Christie is right, if you just want to add a border you should use :hover in your css, if this is just for testing then http://jsfiddle.net/6rnU4/10/ this now works.
further to the changes above, In your css the .hover was being overridden by #small-image img because it has greater specificity.
精彩评论