首页 > 解决方案 > 试图弄清楚如何安装这个 jquery 脚本

问题描述

我正在尝试在此处安装此脚本:https ://www.jqueryscript.net/slider/Basic-Content-Carousel-Slider-Plugin-With-jQuery-gaBasicSlider.html

我对 jquery 了解不多,但是,我尽量按照说明进行操作。

在他们所说的使用以下代码初始化插件的说明的第 3 步:

$(document).ready(function(){         
  $('#example').gaBasicSlider();
});

并且这些设置可供使用:

// enable auto rotation
animate: true,
// animation delay time
animationDelay: 6000,
// animation duration time
animationTime: 300,
// CSS selector for custom indicator
indicators: null,
// CSS selector for custom next button
btnNext: null,
// CSS selector for custom previous button
btnPrevious: null

所以我的问题是,我如何使用上面的设置?我尝试做这样的事情,但是设置似乎没有生效。我做错了吗?见下文:

$(document).ready(function(){         
      $('#example').gaBasicSlider();
     animationDelay: 2000,
     animationTime: 100,
    });

我是否在正确的地方使用了设置?或者它应该是一个单独的功能还是什么?

标签: javascriptjquery

解决方案


像这样:

$('#example').gaBasicSlider({
  btnNext : $('#example-next'),
  btnPrevious : $('#example-previous'),
  indicators : $('#example-indicators'),
  animate: false
});

推荐阅读