jQuery like image swap in YUI
Im trying to replicate a simple hover effect in YUI just like you would with jQuery however its a little confus开发者_StackOverflow社区ing. As in jquery it would go:
$('.hoverclass').hover(function() {
$(this).addClass('up');
}, function() {
$(this).removeClass('up');
});
Any pointers how to do it in YUI?
Thanks.
Why do you even need JS for this. Can't you just use CSS for this?
Well anyway check the source for this sample from Edwart Visser
YUI Hover
The JS which is most of interest to you
YUI Hover JS (there is some other code in it for yui module detecion, skip to this comment /* HOVER CODE */
)
精彩评论