zoukankan      html  css  js  c++  java
  • 下载站焦点图

    /*
        down.js by sunhw
        2014-11-17
    */
    ;(function(){
        function SiderFocus(option){
            this.option = T.object.extend({
                root : '',
                dot : '',
                list : '',
                autoTime : 5000
            }, option || {});
            this.map = {
                currCls : 'on',
                visiCls : 'visible',
                hidden : 'hidden'
            };
            this.index = 0;
            this.dots = T.query('a', T.get(this.option.dot));
            this.lists = T.query('li', T.get(this.option.list));
            this.init();
        }
        SiderFocus.prototype.bind = function(index){
            var me = this;
            me.index = index;
            T.each(me.lists, function(item){
                T.setStyle(item, 'visibility', me.map.hidden);
            });
            T.each(me.dots, function(item){
                T.removeClass(item, me.map.currCls);
            });
            T.addClass(me.dots[me.index], me.map.currCls);
            T.setStyle(me.lists[me.index], 'visibility', me.map.visiCls);
        }
        SiderFocus.prototype.autoPlay = function(){
            var me = this;
            clearInterval(me.autoTimer);
            me.autoTimer = setInterval(function(){
                if(me.index >= 3){
                    me.index = 0;
                }else{
                    me.index++;
                }
                me.bind(me.index);
            }, me.option.autoTime);
        }
        SiderFocus.prototype.init = function(){
            var me = this;
            me.autoTimer = 0;
            T.each(me.dots, function(item, index){
                T.on(item, 'mouseover', function(e){
                    T.event.stop(T.event.get(e));
                    clearInterval(me.autoTimer);
                    me.bind(index);
                });
            });
            T.on(T.get(me.option.root), 'mouseover', function(){
                clearInterval(me.autoTimer);
            });
            T.on(T.get(me.option.root), 'mouseout', function(){
                me.autoPlay();
            });
            me.autoPlay();
        }
        T.dom.ready(function(){
            new SiderFocus({
                root : 'slide-focus',
                dot : 'down-slide-nums',
                list : 'slide-focus-ul',
                autoTime : 5000
            });
        });
    })();

  • 相关阅读:
    oracle数据库卸数及ddl导出
    服务器重新启动,ftp重新连接问题
    服务器重新启动,oracle数据库重新连接问题
    JQ中mouseover和mouseenter的区别
    JQ中 trigger()和triggerHandler()区别
    jquery parent和parents的区别
    javascript坐标:event.x、event.clientX、event.offsetX、event.screenX 用法
    echart.js的使用与API
    HtmlDocument
    触摸事件+手势事件
  • 原文地址:https://www.cnblogs.com/sunhw360/p/4139726.html
Copyright © 2011-2022 走看看