YUI 中类似 jQuery 的图像交换

发布于 2024-08-08 05:39:12 字数 251 浏览 1 评论 0原文

我试图在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜唯美灬不弃 2024-08-15 05:39:12

为什么你甚至需要 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 */)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文