jquery 横向折叠插件lateral-fold网页js特效
  • 内容
  • 相关

网页特效


jquery 横向折叠插件lateral-fold,点击横向得选项卡,产生横向折叠展开的效果,也可以当做横向切换的选项卡使用。

 横向折叠插件核心样式

/*依赖的css 其中的 height: 300px; width: 40px; background 都是随手定义的,请自定义您的样式*/
      .lateral-fold{height: 460px; overflow: hidden;}
      .lateral-fold li,.lateral-fold-tab{width: 102px; height: 100%; float: left; }
      .lateral-fold li{ overflow: hidden; transition: all 0.5s;}
      .lateral-fold-tab{background: #fff;}
      .lateral-fold-con{ overflow: hidden;width: 0;}
.active {
   background: red;
   width: 102px;
   height: 460px;
}
      /*自定义*/
      #test1{width: 1200px; border:#ddd solid 1px; margin: 0 auto;}
      #test1 ul{ height: 460px; }
      #test1 ul li{width: 102px;}
      #test1 .lateral-fold-tab{}
      #test1 .lateral-fold-con{}
 横向折叠插件核心js代码



$.extend($.fn,{
    lateralFold:function(callback){
        //event 事件 可以是 click 或者 mouseenter 注册在盒子的data-event="mouseenter" ,默认 click
        return this.each(function(){
            var $box = $(this),
                    $lis = $box.children("li"),
     
     
     boxWidth = $box.width(),
                    tabWidth = $box.find(".lateral-fold-tab").eq(0).width();

            var event = $box.data("event")||"click";
            var liWidth = boxWidth - tabWidth * ($lis.length-1);

            $box.on(event,".lateral-fold-tab",function(){
                var $this = $(this),$p = $this.closest("li");
                if($p.hasClass("on")){
                    return
                }
                $p.addClass("on").css("width",liWidth).siblings("li").removeClass("on").css("width",102);
                typeof callback=="function" && callback.call(this,$box);
            });

            //初始化
            $box.children(".on").css("width",liWidth);
            typeof callback=="function" && callback.call(this,$box);
        });
    }
});

//调用测试
$(".lateral-fold").lateralFold();






jquery 横向折叠插件lateral-fold网页js特效-下载页面
评论后还是无法显示下载地址?清理缓存-点我试试
热度:2029° 评分:8.7 发布时间: 2017年8月18日

本文标签:

版权声明:若无特殊注明,本文皆为《小洋vier》原创,转载请保留文章出处。

本文链接:jquery 横向折叠插件lateral-fold网页js特效

发表评论

电子邮件地址不会被公开。 必填项已用*标注