当我使用“向上”的方向时,我注意到每次第一项向上滚动时,滚动至少会暂停1-2秒,并且在随后的循环中发生。我在IE、Firefox和chrome上尝试过这个,行为也是一样的。
滚动一点也不应该停顿。它应该不断滚动。
这是我的样本html。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html >
<head>
<title>News Ticker Demo</title>
<style type="text/css">
BODY {BACKGROUND-COLOR: #FFF; COLOR: #000;margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:0.75em;}
#NewsTickerItems{border:1px solid black;padding:1px;}
.latestnews .NewsItem{margin-top:30px;margin-left:10px;}
.latestnews #NewsTickerItems {height: 105px;overflow: hidden;margin-top:10px;}
.latestnews{padding-left:15px;padding-right:15px;}
</style>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery.marquee.js"></script>
</head>
<body>
<div class="latestnews">
<div id='NewsTickerItems'>
<div class="NewsItem">
<b>10/10/2014</b>
Lorem Ipsum is simply dummy text
</div>
<div class="NewsItem">
<b>10/10/2014</b>
Lorem Ipsum is simply dummy text
</div>
<div class="NewsItem">
<b>10/10/2014</b>
Lorem Ipsum is simply dummy text
</div>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#NewsTickerItems').marquee({
//speed in milliseconds of the marquee
speed: 4000,
//gap in pixels between the tickers
delayBeforeStart: 0,
//'left' or 'right' or 'up' or 'down'
direction: 'up',
//true or false - should the marquee be duplicated to show an effect of continues flow
duplicated: false,
//on hover pause the marquee
pauseOnHover: true
});
});
</script>
</body>
</html>发布于 2014-11-13 05:40:37
你想试试HTML5标牌吗?
HTML:
<marquee direction="up" id="myMarquee">This is a marquee.</marquee> JavaScript:
$(function () {
var myMarquee = $('#myMarquee')[0];
setTimeout(function() {
myMarquee.stop();
setTimeout(function(){
myMarquee.start();
run();
},5000);
},1000);
}); 你只需要适应你所需要的时间
https://stackoverflow.com/questions/26901588
复制相似问题