您好,欢迎来到源码搜藏!分享精神,快乐你我!提示:担心找不到本站?在百度搜索“源码搜藏”,网址永远不丢失!
  • 首 页
  • 在线工具
  • 当前位置:首页 > 网页特效 > 焦点图 >

    jquery带位置图标按钮焦点图

    时间:2014-08-04 08:39 来源:互联网 作者:源码搜藏 浏览:收藏 挑错 推荐 打印

    效果预览 进入下载地址列表

    jquery带位置图标按钮焦点图jquery带位置图标按钮焦点图是一款来自IDC网站通栏带位置图标按钮切换焦点图代码。jQuery宽屏图片切换索引按钮 所属专题:焦点图代码

    <script type="text/javascript">
    (function(){
           if(!Function.prototype.bind){
               Function.prototype.bind = function(obj){
                   var owner = this,args = Array.prototype.slice.call(arguments),callobj = Array.prototype.shift.call(args);
                   return function(e){e=e||top.window.event||window.event;owner.apply(callobj,args.concat([e]));};
               };
           }
       })();
       var banner_tabs = function(id){
           this.ctn = document.getElementById(id);
           this.adLis = null;
           this.btns = null;
           this.animStep = 0.2;//动画速度0.1~0.9
           this.switchSpeed = 6;//自动播放间隔(s)
           this.defOpacity = 1;
           this.tmpOpacity = 1;
           this.crtIndex = 0;
           this.crtLi = null;
           this.adLength = 0;
           this.timerAnim = null;
           this.timerSwitch = null;
           this.init();
       };
       banner_tabs.prototype = {
           fnAnim:function(toIndex){
               if(this.timerAnim){window.clearTimeout(this.timerAnim);}
               if(this.tmpOpacity <= 0){
                   this.crtLi.style.opacity = this.tmpOpacity = this.defOpacity;
                   this.crtLi.style.filter = 'Alpha(Opacity=' + this.defOpacity*100 + ')';
                   this.crtLi.style.zIndex = 0;
                   this.crtIndex = toIndex;
                   return;
               }
               this.crtLi.style.opacity = this.tmpOpacity = this.tmpOpacity - this.animStep;
               this.crtLi.style.filter = 'Alpha(Opacity=' + this.tmpOpacity*100 + ')';
               this.timerAnim = window.setTimeout(this.fnAnim.bind(this,toIndex),50);
           },
           fnNextIndex:function(){
               return (this.crtIndex >= this.adLength-1)?0:this.crtIndex+1;
           },
           fnSwitch:function(toIndex){
               if(this.crtIndex==toIndex){return;}
               this.crtLi = this.adLis[this.crtIndex];
               for(var i=0;i<this.adLength;i++){
                   this.adLis[i].style.zIndex = 0;
               }
               this.crtLi.style.zIndex = 2;
               this.adLis[toIndex].style.zIndex = 1;
               for(var i=0;i<this.adLength;i++){
                   this.btns[i].className = '';
               }
               this.btns[toIndex].className = 'cur'
               this.fnAnim(toIndex);
           },
           fnAutoPlay:function(){
               this.fnSwitch(this.fnNextIndex());
           },
           fnPlay:function(){
               this.timerSwitch = window.setInterval(this.fnAutoPlay.bind(this),this.switchSpeed*1000);
           },
           fnStopPlay:function(){
               window.clearTimeout(this.timerSwitch);
           },
           init:function(){
               this.adLis = this.ctn.getElementsByTagName('li');
               this.btns = this.ctn.getElementsByTagName('cite')[0].getElementsByTagName('span');
               this.adLength = this.adLis.length;
               for(var i=0,l=this.btns.length;i<l;i++){
                   with({i:i}){
                       this.btns[i].index = i;
                       this.btns[i].onclick = this.fnSwitch.bind(this,i);
                       this.btns[i].onclick = this.fnSwitch.bind(this,i);
                   }
               }
               this.adLis[this.crtIndex].style.zIndex = 2;
               this.fnPlay();
               this.ctn.onmouseover = this.fnStopPlay.bind(this);
               this.ctn.onmouseout = this.fnPlay.bind(this);
           }
       };
       var player1 = new banner_tabs('banner_tabs');
    </script>

    jquery带位置图标按钮焦点图由源码搜藏网整理,转载请注明出处http://www.codesocang.com/texiao/jiaodiantu/9908.html 源码搜藏承诺:本站所有资源无病毒,无弹窗,无干扰链接!