
下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
var glume = function(banners_ID,focus_ID){ this.$ctn = $('#' + banners_ID); this.$focus = $('#' + focus_ID); this.$adlis = null; this.$btns = null; this.switchSpeed = 5;//自动播放间隔(s) this.defOpacity = 1; this.crtIndex = 0; this.adLength = 0; this.timerSwitch = null; this.init();};glume.prototype = { fnNextIndex:function(){ return (this.crtIndex >= this.adLength-1)?0:this.crtIndex+1; },//动画切换 fnSwitch:function(toIndex){ if(this.crtIndex==toIndex){return;} this.$adlis.CSS('zIndex',0); this.$adlis.filter(':eq('+this.crtIndex+')').CSS('zIndex',2); this.$adlis.filter(':eq('+toIndex+')').CSS('zIndex',1); this.$btns.removeClass('on'); this.$btns.filter(':eq('+toIndex+')').addClass('on'); var me = this; $(this.$adlis[this.crtIndex]).animate({ opacity: 0 },1000,function() { me.crtIndex = toIndex; $(this).CSS({ opacity: me.defOpacity,zIndex: 0 }); }); },fnAutoplay:function(){ this.fnSwitch(this.fnNextIndex()); },fnPlay:function(){ var me = this; me.timerSwitch = window.setInterval(function() { me.fnAutoplay(); },me.switchSpeed*1000); },fnStopPlay:function(){ window.clearTimeout(this.timerSwitch); this.timerSwitch = null; },init:function(){ this.$adlis = this.$ctn.children(); this.$btns = this.$focus.children(); this.adLength = this.$adlis.length; var me = this; //点击切换 this.$focus.on('click','a',function(e) { e.preventDefault(); var index = parseInt($(this).attr('data-index'),10) me.fnSwitch(index); }); this.$adlis.filter(':eq('+ this.crtIndex +')').CSS('zIndex',2); this.fnPlay(); //hover时暂停动画 this.$ctn.hover(function() { me.fnStopPlay(); },function() { me.fnPlay(); }); if($.browser.msIE && $.browser.version < 7) { this.$btns.hover(function() { $(this).addClass('hover'); },function() { $(this).removeClass('hover'); }); } }};var player1 = new glume('_banners','_focus'); 以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的腾讯微云网站首页抠下来的全屏焦点图(jQuery)全部内容,希望文章能够帮你解决腾讯微云网站首页抠下来的全屏焦点图(jQuery)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)