ExtJs实现多选项卡的滚动效果
系统
1859 0
多选项卡的滚动效果图:
实现代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>多选项卡的滚动效果</title>
<script type="text/javascript" src="jquery.min.js"></script>
<style>
h1,h2,h3,h4,h5,h6,p,ol,ul,li,dl,dt,dd{padding:0;margin:0;}
li{list-style:none;}
img{border:none;}
u{text-decoration:none;}
em{font-style:normal;}
a{color:#424242;text-decoration:none;outline:none;blr:expression(this.onFocus=this.blur());}
body{font-size:12px;font-family: Arial,Verdana, Helvetica, sans-serif; word-break:break-all;}
.box{margin:0 auto;text-align:left;width:920px;}
.clear{clear:both;}
.contain{
height:30px;
width:240px;
position:relative;
overflow:hidden;
float:left;
}
.tab{
background:#eee;
position:absolute;
width:600px;
left:0;
}
.tab li{
float:left;
background:#fff;
color:#666;
margin:4px;
padding:2px;
cursor:pointer;
}
.tab .active{
background:#06c;
color:#fff;
}
.prev,.next{
float:left;
display:block;
height:25px;
line-height:25px;
border:solid 1px #ddd;
background:#efefef;
width:15px;
font-family:宋体;
text-align:center;
cursor:pointer;
}
span.prev{
left:200px;
}
.dis{
color:#ccc;
cursor:auto;
}
.content{
width:252px;
height:50px;
border:1px solid #ccc;
padding:10px;
clear:both
}
</style>
<script type="text/javascript">
$(function(){
var current=1;
var count=$('.tab li').length;
$('.prev').addClass('dis');
$('.next').click(function(){
if(current<count-3){
$('.next').removeClass('dis');
$('.prev').removeClass('dis');
$('.tab').animate({left:'-='+60},600);
current++;
$('.current').html(current);
}
if(current==count-3){
$('.next').addClass('dis');
}
});
$('.prev').click(function(){
if(current>1){
$('.next').removeClass('dis');
$('.prev').removeClass('dis');
$('.tab').animate({left:'+='+60},600);
current--;
$('.current').html(current);
}
if(current==1){
$('.prev').addClass('dis');
}
});
$('.content div:gt(0)').hide();
$('.tab li:first').addClass('active');
$('.tab li').click(
function(){
$(this).addClass('active').siblings().removeClass('active');
$('.content div').eq($(this).index('.tab li')).siblings().hide().end().show();
}
);
});
</script>
</head>
<body>
<span class="current">1</span><br>
<span class="prev"><</span>
<div class="contain">
<ul class="tab">
<li>tab1</li>
<li>tab2</li>
<li>tab3</li>
<li>tab4</li>
<li>tab5</li>
<li>tab6</li>
<li>tab7</li>
<li>tab8</li>
</ul>
</div>
<span class="next">></span>
<div class="content">
<div>1111111</div>
<div>2222222</div>
<div>3333333</div>
<div>4444444</div>
<div>5555555</div>
<div>6666665</div>
<div>7777777</div>
<div>8888888</div>
</div>
</body>
</html>
ExtJs实现多选项卡的滚动效果
更多文章、技术交流、商务合作、联系博主
微信扫码或搜索:z360901061
微信扫一扫加我为好友
QQ号联系: 360901061
您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。
【本文对您有帮助就好】元