YUI 中类似 jQuery 的图像交换
我试图在 YUI 中复制一个简单的悬停效果,就像使用 jQuery 一样,但它有点令人困惑。 就像在 jquery 中一样,它会这样:
$('.hoverclass').hover(function() {
$(this).addClass('up');
}, function() {
$(this).removeClass('up');
});
任何指针如何在 YUI 中做到这一点?
谢谢。
Im trying to replicate a simple hover effect in YUI just like you would with jQuery however its a little confusing.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么你甚至需要 JS 来做这个。你不能只使用 CSS 来实现这个吗?
无论如何,请检查 Edwart Visser 的此示例的来源
YUI Hover
大部分的 JS你感兴趣
YUI Hover JS (其中还有一些用于 yui 的其他代码模块检测,跳到此注释
/* HOVER CODE */
)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 */
)