jQuery Cycle插件-暂停/恢复奇怪的行为 [英] jQuery Cycle plugin - pause/resume weird behavior

查看:80
本文介绍了jQuery Cycle插件-暂停/恢复奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行有很棒的循环插件的幻灯片,当您单击节目中的一个按钮时,我在页面上显示了一个隐藏层,并发送了"pause"命令来循环.我有两个问题:

I have a slideshow running with the awesome cycle plugin, and when you click a button in the show, I show a hidden layer on the page and send a 'pause' command to cycle. I'm having two problems:

  1. 收到暂停命令后,循环立即按顺序返回到第一张幻灯片(为什么?),并且不会在我的回调之前/之后发生变化.

  1. When the pause command is received, cycle immediately flips back to the 1st slide in the sequence (why??), and doesn't hit my before/after callbacks.

关闭图层后,我发送"resume"命令进行循环.幻灯片继续播放(从第一个幻灯片停下来的位置开始),但是即使幻灯片进行到现在,循环也根本不调用我的前后回调.

After closing the layer, I send a 'resume' command to cycle. The slideshow resumes (from the 1st slide, where the pause left it), but now cycle doesn't call my before/after callbacks at all, even as the slideshow progresses.

所以我想我的问题是:如何正确暂停/恢复幻灯片显示,以免发生这些奇怪的行为? (并且为了完全清楚起见,避免出现任何混乱,这与暂停时暂停"功能无关,它实际上对我来说很好用.:-)

So I guess my question is: how can I properly pause/resume the slideshow so these strange behaviors don't occur? (And just to be completely clear and avoid any confusion, this isn't about the "pause on hover" feature, which is actually working fine for me. :-)

这是我的cycle()初始化和回调函数. (您问我为什么要手动跟踪nextSlide?因为当前幻灯片的内置值无法在回调之前/之后正确更新.)

Here's my cycle() init, and my callback functions. (Why am I manually tracking the nextSlide, you ask? Because the built-in value for the current slide doesn't get updated properly for the before/after callbacks.)

  $(document).ready(function() {
    $('#slideshow').cycle({
      fx: 'fade',        // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance)
        speed:         1000,  // speed of the transition (any valid fx speed value)
        pause:         1,     // true to enable "pause on hover"
        delay:         0,     // additional delay (in ms) for first transition (hint: can be negative)
        slideExpr:     'img',  // expression for selecting slides (if something other than all children is required)
        before:       moveArrow, // function to call when moving to next slide
        after:       upd, // function to call when moving to next slide
        fastOnEvent:   'fast',
    });
  });

  var nextSlide = 0;

  function upd(a, b, c) {
    nextSlide = nextSlide + 1;        // track which slide we're on
    c = $('#slideshow img').length;
    if(nextSlide > (c - 1)) nextSlide = 0;   // wrap back to 1st
  }

  // move indicator showing which slide we're on
  function moveArrow(a, b, c) {
    $('#slide-indicator').attr('class', 'c'+nextSlide);

    $(".clickmap").hide();          // hide other clickmaps
    $(".clickmap.c"+nextSlide).show();    // show map for this slide

    return true;
  }

感谢对此的任何想法-

最好, 埃里克

推荐答案

我遇到了同样的问题,暂停和恢复均不起作用.看来我已经安装了精简版,并且可以使用完整/完整版.

I had the same problem, pause and resume were not working. It appeared I had installed the lite version, with the full/complete version it's working.

这篇关于jQuery Cycle插件-暂停/恢复奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆