<style>
* { margin:0; padding:0;}
ul { list-style:none; margin:0; padding:0;}
img { border:none;}
.bar {
margin:0 auto;
width:800px; height:48px; overflow:hidden;
line-height:48px; border:2px solid #EEE;}
.bar a.a_left,
.bar a.a_right{
float:left;
width:11px; height:48px;
background:url(a_left.png) no-repeat left center;}
.bar a.a_right { float:right; background-image:url(a_right.png);}
.bar_wrap { float:left; position:relative; width:776px; height:48px; white-space:nowrap; overflow:hidden;}
.bar_inner { position:relative; height:48px; line-height:48px; left:0; width:2880px; white-space:nowrap;}
.bar_inner ul { height:48px; overflow:hidden; float:left; width:960px;}
.bar_inner ul li{ float:left;}
.bar_inner ul li a{ padding:0 16px; display:block; height:48px; line-height:48px;}
</style>
<body>
<div class="bar">
<a href="#" class="a_left"></a>
<div class="bar_wrap">
<div class="bar_inner">
<ul>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
<li><a href="#" title="" ><img src="pic.png" alt="" /></a></li>
</ul> </div>
</div>
<a href="#" class="a_right"></a>
</div>
var scrollBar = function(){
this.step = 14;
this.speed = 100;
this.inner = $(".bar_inner");
this.wrap = $(".bar_wrap");
this.ini = 0;
this.pos = "l";
this.s ;
}
scrollBar.prototype = {
check : function(){
return this.inner.width() < this.wrap.width() ? false : true;
} ,
init : function(){
if( this.check() ){
this.inner
.html( this.inner.html() + this.inner.html() + this.inner.html() )
.css("left",- this.inner.width()/3 + "px");
}
},
run : function(pos){
if (! this.check()){ return;}
if( this.ini == 0) {this.init();}
this.ini = 1;
this.pos = pos;
var that = this;
var f = function(){
if(that.pos == "l"){
var l = parseInt( that.inner.css("left") ) - that.step;
that.inner.css("left",l + "px");
//console.log(l);
if ( parseInt(that.inner.css("left")) <= -( that.inner.width()/ 3 * 2) ){
that.inner.css("left",- that.inner.width() /3 + "px");
}
}
else {
var l = parseInt( that.inner.css("left") ) + that.step;
that.inner.css("left",l + "px");
//console.log( l );
if( parseInt(that.inner.css("left")) >= 0 ){
that.inner.css("left", - that.inner.width()/3 + "px");
}
}
}
if(this.s) {clearInterval(that.s);};
this.s = setInterval( f ,that.speed);
that.inner.hover(
function(){ clearInterval(that.s);},
function(){clearInterval(that.s); that.s = setInterval( f ,that.speed); }
)
}
}
var s = new scrollBar();
s.run("r");
$(".a_left").mouseover(function(){
clearInterval( s.s);
s.run("l");
})
$(".a_right").mouseover(function(){
clearInterval( s.s);
s.run("r");
})
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有