模仿easyUI 实现tab切换

模仿easyUI 实现tab切换

1:  复制easyui css的部分样式;

2:通过加载链接实现动态切换;

效果图:





<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="copyright"
content="All Rights Reserved, Copyright (C) 2013, Wuyeguo, Ltd.">
<title>EasyUI Web Admin Power by Wuyeguo</title>
<script type="text/javascript"
src="jslib/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
<style type="text/css">
.tabs-wrap{
position:relative;
left:0px;
overflow:hidden;
width:100%;
margin:0px;
padding:0px;
background-color: #E0ECFF;
border:1px;
}


.tabs{
list-style-type:none;
height:26px;
margin:0px;
padding:0px;
padding-left:4px;
font-size:12px;
width:5000px;
border-bottom:1px solid #8DB2E3;
}
.tabs li{
float:left;
display:inline-block;
margin-right:4px;
margin-bottom:-1px;
padding:0;
position:relative;
border:1px solid #8DB2E3;
-moz-border-radius:5px 5px 0 0;
-webkit-border-radius:5px 5px 0 0;
border-radius:5px 5px 0 0;
}
.tabs li a.tabs-inner{
display:inline-block;
text-decoration:none;
color:#416AA3;
background:url('images/tabs_enabled.png') repeat-x left top;
margin:0px;
padding:0px 10px;
height:25px;
line-height:25px;
text-align:center;
white-space:nowrap;
-moz-border-radius:5px 5px 0 0;
-webkit-border-radius:5px 5px 0 0;
border-radius:5px 5px 0 0;
}
.tabs li a.tabs-inner:hover{
background:url('images/tabs_active.png') repeat-x left bottom;
}
.tabs li.tabs-selected{
border:1px solid #8DB2E3;
border-bottom:1px solid #fff;
}
.tabs li.tabs-selected a.tabs-inner{
color:#416AA3;
font-weight:bold;
background:#fff;
background:#e0ecff url('images/tabs_active.png') repeat-x left bottom;
outline: none;
}


.tabs-container{
overflow:hidden;
background:#fff;
}
.tabs-header{
border:1px solid #8DB2E3;
background:#E0ECFF;
border-bottom:0px;
position:relative;
overflow:hidden;
padding:0px;
padding-top:2px;
overflow:hidden;
}




.tabs-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    left: 10px;
    top: 5px;
}
    
a:-webkit-any-link {
    cursor: auto;
    text-decoration: underline;
}


li {
    display: list-item;
}


.tabs-closable {
    padding-right: 8px;
}


</style>
</head>
<body>
<div id="tt" class="easyui-tabs tabs-container"
style="width: auto; height: auto;border: 1px;">
<div class="tabs-header">
<div class="tabs-scroller-left" style="display: none;"></div>
<div class="tabs-scroller-right" style="display: none;"></div>
<div class="tabs-wrap" >
<ul class="tabs">
<li class="tabs-selected"><a href="javascript:void(0)" class="tabs-inner"><span
class="tabs-title tabs-closable">AD</span><span class="tabs-icon"></span></a><a
href="javascript:void(0)" class="tabs-close"></a></li>
<li class=""><a href="javascript:void(0)"
class="tabs-inner"><span class="tabs-title tabs-closable">CAD</span><span
class="tabs-icon"></span></a><a href="javascript:void(0)"
class="tabs-close"></a></li>
<li class=""><a href="javascript:void(0)" class="tabs-inner"><span
class="tabs-title tabs-closable">SB</span><span class="tabs-icon"></span></a><a
href="javascript:void(0)" class="tabs-close"></a></li>
<li class=""><a href="javascript:void(0)" class="tabs-inner"><span
class="tabs-title tabs-closable">美团</span><span class="tabs-icon"></span></a><a
href="javascript:void(0)" class="tabs-close"></a></li>
</ul>
</div>
<div id="tablist">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
//控制tab标签
    $('ul li').click(function(){
   // alert($(this).text())
        var value = $(this).text();
        $(this).siblings().removeClass('tabs-selected');
        $(this).addClass('tabs-selected');
        if(value === "AD"){
        $("#tablist").html('<iframe scrolling="auto" frameborder="0"  src="'+"http://www.iciba.com/?=2016pcChromebookmark"+'" style="width:100%;height:800px;"></iframe>');
        }
        else if(value ==="CAD"){
        $("#tablist").html('<iframe scrolling="auto" frameborder="0"  src="'+"https://zhidao.baidu.com/daily/view?id=64444"+'" style="width:100%;height:800px;"></iframe>');
        }
        else if(value ==="SB"){
        $("#tablist").html('<iframe scrolling="auto" frameborder="0"  src="'+"http://blog.csdn.net/chjttony/article/details/46647549"+'" style="width:100%;height:800px;"></iframe>');
        }
        else if(value ==="美团"){
        $("#tablist").html('<iframe scrolling="auto" frameborder="0"  src="'+"http://sz.meituan.com/?ref=360"+'" style="width:100%;height:800px;"></iframe>');
        }
        $("#tablist").load("http://www.iciba.com/"+"#tablist");
    })


})
</script>
</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值