jQuery滑块(轮播图)插件simpleSlider.js

所属分类:媒体-幻灯片和轮播图

 132674  406  查看评论 (9)
分享到微信朋友圈
X
jQuery滑块(轮播图)插件simpleSlider.js ie兼容6

使用方法

添加jQuery,simpleSlider.js,touchSwipe.js(可选,如果你想要支持触摸)和transit.js在页面head中。滑块会自动改变useTransitionEnd属性为true。您可以通过设置禁用这个updateTransit:错误的选项。

<script type="text/javascript" src="transit.js"></script>
<script type="text/javascript" src="touchSwipe.js"></script>
<script type="text/javascript" src="simpleSlider.js"></script>


添加一个div到你的网站包含幻灯片。这些div的标准名称。滑块和。滑,但是这些选项可以改变的对象<div class='slider'>

<div class='slide'>
        <div class='slidecontent'>
            <h1>Solar Dolar Wolar Woot</h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam posuere cursus euismod.Aenean ut tortor leoing elit. Etiam posuere cursus euismod.Aenean ut tortor leo.</h2>
        </div>
    </div>
    <div class='slide' >
        <div class='slidecontent'>
            <h1>Solar Dolar Wolar Woot</h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam posuere cursus euismod.Aenean ut tortor leo.</h2>
        </div>
    </div>
</div>


创建滑块

$(document).ready(function(){
    $(".slider").simpleSlider();
});


自定义选项

您还可以控制simpleSlider的选项。只是对象的选项解析成simpleSlider()。

$(document).ready(function(){
    // Default options
    var options = {
        slides: '.slide', // The name of a slide in the slidesContainer
        swipe: true,    // Add possibility to Swipe > note that you have to include touchSwipe for this
        slideTracker: true, // Add a UL with list items to track the current slide
        slideTrackerID: 'slideposition', // The name of the UL that tracks the slides
        slideOnInterval: true, // Slide on interval
        interval: 5000, // Interval to slide on if slideOnInterval is enabled
        animateDuration: 1500, // Duration of an animation
        animationEasing: 'easeInOut', // Accepts: linear ease in out in-out snap easeOutCubic easeInOutCubic easeInCirc easeOutCirc easeInOutCirc easeInExpo easeOutExpo easeInOutExpo easeInQuad easeOutQuad easeInOutQuad easeInQuart easeOutQuart easeInOutQuart easeInQuint easeOutQuint easeInOutQuint easeInSine easeOutSine easeInOutSine easeInBack easeOutBack easeInOutBack
        pauseOnHover: false // Pause when user hovers the slide container
    };
    $(".slider").simpleSlider(options);
});


控制滑块

你必须有dom元素的数据如果你想控制滑块。下面的代码显示了如何做到这一点

$(document).ready(function(){
    $(".slider").simpleSlider();
    var slider = $(".slider").data("simpleslider");
    slider.nextSlide(); // Go to the next slide
    slider.prevSlide(); // Go to the previous slide
    slider.nextSlide(slidenumber); // Go to the given slide
});

如果启用了滑块与list-items自动创建一个列表,您可以使用它们来控制滑块。


事件

SimpleSlider将引发beforeSliding和afterSliding事件。您可以使用下面的代码绑定这些:

    $(".slider").simpleSlider();
    $(".slider").on("beforeSliding", function(event){
        // Event.prevSlide: previous slide ID
        // Event.newSlide: coming slide ID
    });
    $(".slider").on("afterSliding", function(event){
        // Event.prevSlide: previous slide ID
        // Event.newSlide: coming slide ID
    });

afterSliding动画完成后触发。


相关插件-幻灯片和轮播图

jQuery带缩略图轮播图插件SliderPro

jQuery基于SliderPro实现的左右布局带缩略图轮播图效果
  幻灯片和轮播图
 45088  453

jQuery3D轮播效果

jQuery多个3D环绕滚动效果
  幻灯片和轮播图
 48587  429

jQuery图片轮播插件带缩略图,响应式触屏滑动

jQuery图片轮播插件制作带缩略图的响应式图片轮播,支持手机,移动端触屏滑动图片切换效果
  幻灯片和轮播图
 18997  246

jquery左右全屏渐变切换焦点图特效

全屏渐变切换焦点图特效
  幻灯片和轮播图
 30825  346

讨论这个项目(9)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    小时候的天空为什么那么蓝 0
    2017/9/15 13:19:59
    什么错也没报,图片显示不了
        灰姑娘爱吃士力架0
        2018/4/24 15:46:05
        路径对吗?
    回复
    石石石石石头 0
    2016/4/13 10:04:00
    为什么我下载过来放到WORDPRESS上会不一样 回复
    hegonghe 0
    2015/8/15 22:08:25

    真的不好用哦。。。

    回复
    LEO 0
    2015/4/17 11:32:32
    同一楼,如何设置自动轮播,求解答。 回复
    ▓ 纯牛奶° 0
    2015/3/12 17:58:51
    _ 0
    2015/1/27 22:03:23
    就这么一个效果 除了JQUERY 至少还要引入4个JS 也真是醉了 回复
    WzhoW 0
    2014/9/9 9:18:38
    支持全浏览器的自适应全屏及触控轮播,真是让人感动!只是在文字排版在各个浏览器都不太一样,还是有点兼容问题 回复
    魔界小鸟 0
    2014/7/19 23:12:00

    请问如何设置自动轮播呢?可否指点一下。。

    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复