无缝滚动 js 一

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<style>
body{height:10000px; background:#ccc;}
#gg_left, #gg_right{
position: fixed;
}
#gg_left{width:120px;height:240px;top:230px;left:0;}
#gg_right{width:120px;height:240px;top:230px;right:0;}
</style>
<!--[if lte IE 6]>
<style type="text/css">

#gg_left, #gg_right{
position: absolute;
}
</style>
<![endif]-->

</head>
<body>

<div id="gg_left"><embed src="C:\Users\love\Desktop\320.swf" width="120px;" height="240px;"></div>
<div id="gg_right"><embed src="C:\Users\love\Desktop\320.swf" width="120px;" height="240px;"></div>

<div id="tickerContainer" style="width:400px;margin:10px auto;">
<div id="ticker">
<ul id="demo">edk;cwscdweqweqwdqw</ul>
<ul id="demo">234545qw565656dqw</ul>
<ul id="demo">0fdkfFEP2edk;cwscdweqweqwdqw</ul>
<ul id="demo">0--=-kokfedk;cwscdweqweqwdqw</ul>

</div>
</div>

<script type="text/javascript" src="xxx/jquery.js"></script>(可到网上搜索,或直接用网上的路径,如google的)
<script type="text/javascript">
$(function() {

//cache the ticker
var ticker = $("#ticker");

//wrap dt:dd pairs in divs
ticker.children().filter("demo").each(function() {

var dt = $(this),
container = $("<div>");

dt.next().appendTo(container);
dt.prependTo(container);

container.appendTo(ticker);
});

//hide the scrollbar
ticker.css("overflow", "hidden");

//animator function
function animator(currentItem) {

//work out new anim duration
var distance = currentItem.height();
duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;

//animate the first child of the ticker
currentItem.animate({ marginTop: -distance }, duration, "linear", function() {

//move current item to the bottom
currentItem.appendTo(currentItem.parent()).css("marginTop", 0);

//recurse
animator(currentItem.parent().children(":first"));
});
};

//start the ticker
animator(ticker.children(":first"));

//set mouseenter
ticker.mouseenter(function() {

//stop current animation
ticker.children().stop();

});

//set mouseleave
ticker.mouseleave(function() {

//resume animation
animator(ticker.children(":first"));

});
});
</script>

</body>
</html>

转载于:https://www.cnblogs.com/zhicheng/p/3183680.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值