1
2
3
4
5
6
向左 向右 /** * Created by Administrator on 2015/11/5. */ ///大眼睛效果改进 (function($){ $.fn.focue=function(options){ var defaults={ speed : '2000', //图片切换的速度 conBox:" ", //图片所在位置 mainCell:" ", //数字所在位置 autoPlay:"true" //是否自动播放 }; var opts = $.extend(defaults, options); return this.each(function () { var _wrap=$(this); var sw = 0; var conBox =opts.conBox; var mainCell =opts.mainCell; var autoPlay =opts.autoPlay; var speed =opts.speed; var myTime; var lengtLi=conBox.length; //滑入停止动画,滑出开始动画 _wrap.hover(function(){ clearInterval(myTime); },function(){ if(autoPlay=="true"){ myTime = setInterval(function(){ myShow(sw); sw++; if(sw==lengtLi){sw=0;} } , speed); }else{ clearInterval(myTime); } }).trigger('mouseleave'); //引导文字切换图片 $(mainCell).mouseover(function(){ sw = $(mainCell).index(this); myShow(sw); }); //点击导航目录出来相应内容 function myShow(i){ $(mainCell).eq(i).addClass("cur").siblings("dd").removeClass("cur"); $(conBox).eq(i).stop(true,true).fadeIn(100).siblings("li").fadeOut(100); } //左右箭头效果 $(".sper").click(function(){ //clearInterval(myTime); sw--; if(sw==-1){sw=(lengtLi-1);myShow(sw); } myShow(sw); }).trigger('mouseleave'); $(".snext").click(function(){ if(sw==lengtLi){sw=0;myShow(sw);}else{ myShow(sw); sw++; } }).trigger('mouseleave') }) } })(jQuery);