html图片轮播代码 贴吧,Unslider — 一个超小的 jQuery轮播(slider)插件

Unslider是一个轻量级的滑块插件,提供多种定制选项,如动画速度和延迟。通过添加jQuery.event.swipe插件,它可以支持触摸屏操作。要添加前进和后退链接,可以利用Unslider的方法轻松实现。此外,你可以通过jQuery的数据方法访问和操纵Unslider的各种属性,包括手动控制滑动、启用键盘快捷键和添加导航点。
摘要由CSDN通过智能技术生成

参数

Although it’s lightweight, Unslider comes with a range of options to customise your slider. Here’s the default options provided. You can add, remove, or completely skip out the options object. It’s up to you.

$('.banner').unslider({

speed: 500, // The speed to animate each slide (in milliseconds)

delay: 3000, // The delay between slide animations (in milliseconds)

complete: function() {}, // A function that gets called after every slide animation

keys: true, // Enable keyboard (left, right) arrow shortcuts

dots: true, // Display dot navigation

fluid: false // Support responsive design. May break non-responsive designs

});

支持触摸屏

If you want to add mobile/touch/swipe/whatever support to Unslider, you’ll need to include the jQuery.event.swipe plugin, then it’ll work out the box. Easy!

添加向前(previous)/向后(next)链接

A feature that’s often requested in Unslider, but isn’t included in-the-box, is previous/next links. Luckily, they’re easy enough to add with a little script, which utilises Unslider’s methods.

var unslider = $('.banner').unslider();

$('.unslider-arrow').click(function() {

var fn = this.className.split(' ')[1];

// Either do unslider.data('unslider').next() or .prev() depending on the className

unslider.data('unslider')[fn]();

});

存取Unslider的属性

Using jQuery’s wonderful data method, you can access and manually override any methods. Here’s a list of what you can do:

var slidey = $('.banner').unslider(),

data = slidey.data('unslider');

// Start Unslider

data.start();

// Pause Unslider

data.stop();

// Move to a slide index, with optional callback

data.move(2, function() {});

// data.move(0);

// Manually enable keyboard shortcuts

data.keys();

// Move to the next slide (or the first slide if there isn't one)

data.next();

// Move to the previous slide (or the last slide if there isn't one)

data.prev();

// Append the navigation dots manually

data.dots();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值