【问题标题】:jquery slide using css3 transitions with multiple usejquery幻灯片使用css3转换多次使用
【发布时间】:2013-09-03 02:03:18
【问题描述】:

我的 jquery 幻灯片效果很好,但我需要能够在一个页面中多次使用它。

  • 如何在同一页面中使用 2 张幻灯片?
  • 如果我只有 6 个元素,如何删除下一个和上一个按钮?像下面这样?
  • if ($('.wrap').length

    worksGallery: 函数 () { $('ul.og-grid > li').each(function (i) { 如果 (i % 6 == 0) { $(this).nextAll().andSelf().slice(0, 6).wrapAll('

  • '); } });
      $('ul.og-grid .wrap:gt(0)').removeClass('fadeIn').addClass('fadeout');

      updateNav = function () {
          $('#eventi .prev').toggle($('.wrap:first').hasClass('fadeout'));
          $('#eventi .next').toggle($('.wrap:last').hasClass('fadeout'));
      }

      $('#eventi .prev').click(function (e) {
          e.preventDefault();
          var idx = $('.wrap.fadeIn').index() - 1;
          $('.wrap.fadeIn').addClass('fadeout').removeClass('fadeIn').css("transition",1/(idx+1)+"s").css("transform", "translateX(" + 660 * idx + "px)").index() - 1;
          $('.wrap').eq(idx).addClass('fadeIn').removeClass('fadeout').css("transition",1/(idx+1)+"s").css("transform", "translateX(" + -660 * idx + "px)");
          updateNav();
      });

      $('#eventi .next').click(function (e) {
          e.preventDefault();
          var idx = $('.wrap.fadeIn').index() + 1;
          $('.wrap.fadeIn').addClass('fadeout').removeClass('fadeIn').css("transition",1/(idx+1)+"s").css("transform", "translateX(" + -660 * idx + "px)").index() + 1;
          $('.wrap').eq(idx).addClass('fadeIn').removeClass('fadeout').css("transition",1/(idx+1)+"s").css("transform", "translateX(" + -660 * idx + "px)");
          updateNav();
      });

      updateNav();

      if ($('.wrap').length <= 1) {
          return;
      }

    },

http://jsfiddle.net/yGaj8/5/

【问题讨论】:

    标签: jquery css slideshow css-transitions


    【解决方案1】:

    尝试在 jquery 中使用 hide 。

    【讨论】:

    • 感谢我更加专注于让这张幻灯片以多种方式工作。有什么建议吗?
    • 你能帮忙吗?
    猜你喜欢
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 2011-02-26
    • 2013-01-23
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多