jquery循环与悬停效果

发布于 2024-11-27 16:10:19 字数 657 浏览 1 评论 0原文

大家好,我需要一些帮助,对jquery仍然很陌生,

我正在使用循环插件,到目前为止我有以下内容,我试图找到添加悬停的方法,

这样当用户将鼠标悬停在菜单中的链接上时,它就会循环通过它暂停循环并切换到悬停即用户控制,

但在鼠标移出一段时间后它会恢复

var n=0
var dn=1
$(document).ready(function() {
$('.slideshow') 
.cycle({ 
fx:     'fade', 
speed:  500, 
timeout: 3000, 
before: function(curr, next, opts) {
     n=n+1;
    if (n>5) {n=1;dn=5}
    $('#item'+dn).removeClass("active");
    $('#item'+(n)).addClass("active");
    dn=n;
    } 
});

$(".slideshow").cycle('resume');

$(".slideshow").mouseover(function(){
  $(this).cycle('pause');
}).mouseout(function(){
  $(this).cycle('resume');
});
});

对此的任何帮助将非常感谢

hi all i need some help still very new to jquery

i am using the cycle add-on i have the following so far i am trying to find away of adding onto it a hover

so when a user hovers over the links in menu it is cycling through it pauses the cycle and switch to hover ie user control

but after awhile of mouse-out it resumes

var n=0
var dn=1
$(document).ready(function() {
$('.slideshow') 
.cycle({ 
fx:     'fade', 
speed:  500, 
timeout: 3000, 
before: function(curr, next, opts) {
     n=n+1;
    if (n>5) {n=1;dn=5}
    $('#item'+dn).removeClass("active");
    $('#item'+(n)).addClass("active");
    dn=n;
    } 
});

$(".slideshow").cycle('resume');

$(".slideshow").mouseover(function(){
  $(this).cycle('pause');
}).mouseout(function(){
  $(this).cycle('resume');
});
});

any help on this would be great thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

花开半夏魅人心 2024-12-04 16:10:19
$(".slideshow").hover(function(){
    clearTimeout();
    $(this).cycle('pause');
}, function(){
    setTimeout(function(){
        $(this).cycle('resume');
    }, 500);
});

当前设置为在未将鼠标悬停在幻灯片上 500 毫秒后恢复。

$(".slideshow").hover(function(){
    clearTimeout();
    $(this).cycle('pause');
}, function(){
    setTimeout(function(){
        $(this).cycle('resume');
    }, 500);
});

Current set to resume after 500ms of not hovering over the slideshow.

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