我知道 html marquee 标记已被弃用,并且为了正确标记我们不应该使用它,所以我正在尝试用 javascript 编写替代方案。我的问题如下:
我需要有方向箭头来改变滚动方向
我需要它在悬停时暂停
这是我到目前为止所拥有的......
<style type="text/css">
#container-HmS {
position:relative;
width:710px;
height:75px;
overflow:hidden;
border:1px solid #ccc;
background-color:#fff;
margin:0 auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#div1-HmS {
position:absolute;
left:0px;
top:0px;
width:708px;
height:73px;
}
#div2-HmS {
position:absolute;
left:713px;
top:0px;
width:713px;
height:73px;
}
</style>
<script type="text/javascript">
var m=0;
var n=713;
var speed=20;
function scrollPics() {
document.getElementById('div1-HmS').style.left=m+'px';
document.getElementById('div2-HmS').style.left=n+'px';
m--;
n--;
if(m==-713) {
m=713;
}
if(n==-713) {
n=713;
}
setTimeout('scrollPics()',speed);
}
window.onload=function() {
scrollPics();
}
</script>
<div id="container-HmS">
<div id="div1-HmS">
<a href="http://store.vibrant.com/Cisco_bymfg_9-8-1.html"><img src="assets/templates/v32028/images/logo-slider_01.png" alt=""></a>
<a href="http://store.vibrant.com/Dell_bymfg_4-8-1.html"><img src="assets/templates/v32028/images/logo-slider_02.png" alt=""></a>
<a href="http://store.vibrant.com/HP_bymfg_18-8-1.html"><img src="assets/templates/v32028/images/logo-slider_03.png" alt=""></a>
<a href="http://store.vibrant.com/ibm-_bymfg_133-8-1.html"><img src="assets/templates/v32028/images/logo-slider_04.png" alt=""></a>
<a href="http://store.vibrant.com/search.asp?keyword=oracle"><img src="assets/templates/v32028/images/logo-slider_05.png" alt=""></a>
<a href="http://store.vibrant.com/EMC_bymfg_22-8-1.html"><img src="assets/templates/v32028/images/logo-slider_06.png" alt=""></a>
</div>
<div id="div2-HmS">
<a href="http://store.vibrant.com/Cisco_bymfg_9-8-1.html"><img src="assets/templates/v32028/images/logo-slider_01.png" alt=""></a>
<a href="http://store.vibrant.com/Dell_bymfg_4-8-1.html"><img src="assets/templates/v32028/images/logo-slider_02.png" alt=""></a>
<a href="http://store.vibrant.com/HP_bymfg_18-8-1.html"><img src="assets/templates/v32028/images/logo-slider_03.png" alt=""></a>
<a href="http://store.vibrant.com/ibm-_bymfg_133-8-1.html"><img src="assets/templates/v32028/images/logo-slider_04.png" alt=""></a>
<a href="http://store.vibrant.com/search.asp?keyword=oracle"><img src="assets/templates/v32028/images/logo-slider_05.png" alt=""></a>
<a href="http://store.vibrant.com/EMC_bymfg_22-8-1.html"><img src="assets/templates/v32028/images/logo-slider_06.png" alt=""></a>
</div>
</div>
我完全没有想法……有人吗?