基于jquery实现轮播焦点图插件

基于jquery实现轮播焦点图插件

直接上代码,可能不是最好的,欢迎吐槽。

/**
* Created by Steven on 2015/07/10/0010.
* @email zhuttymore@126.com
*/

(function ($) {

$.fn.slider = function (opt) {
opt = $.extend({
speed:fast,
auto: false,
interval: 1000
}, opt);

var _this = this;
var index = 0;
_this.find(.window li).width(_this.width());

var animate = function(index){
var win = _this.find(.window);
var offset = win.parent().width();
win.animate({marginLeft: -offset * index}, opt.speed);
_this.find(.tab li).removeClass(select);
_this.find(.tab li).eq(index).addClass(select);
};

_this.find(.tab li).mouseover(function () {
index = parseInt($(this).index());
animate(index);

});

_this.find(.btn li:first-child).click(function(){
–index;
if(index

© 版权声明

相关文章

暂无评论

none
暂无评论...