首页 > 语言 > JavaScript > 正文

Tab切换组件(选项卡功能)实例代码

2024-05-06 14:33:08
字体:
来源:转载
供稿:网友

直接贴代码里面有注释:

代码如下:
/**
 * 简单的Tab切换
 * 支持可配置项 如下参数
 */
    function Tab(){
        this.config = {
            type            : 'mouseover',    //类型 默认为鼠标移上去
            autoplay        : true,           // 默认为自动播放
            triggerCls      : '.list',        // 菜单项
            panelCls        : '.tabContent',  // 内容项
            index           : 0,              // 当前的索引0
            switchTo        : 0,              // 切换到哪一项
            interval        : 3000,              // 自动播放间隔时间 默认为3 以s为单位
            pauseOnHover    : true,           // 鼠标放上去是否为暂停 默认为true
            current         : 'current',      // 当前项添加到类名
            hidden          : 'hidden',       // 类名 默认为hidden
            callback        : null            // callback函数
        };

        this.cache = {
            timer : undefined,
            flag  : true
        };
    }

    Tab.prototype = {

        init: function(options){
            this.config = $.extend(this.config,options || {});

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选