文字向上周期滚动,滚上一次,就停止几秒钟,再滚动,接着停止几秒钟... ... 循环如此周期滚动着~~~`
这样的特效代码怎么弄??
我在网上找了好久没找到合适的,谢谢大家
<!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=gb2312" />
<title></title>
<script type="text/javascript">
var RollAd=(function() {
var _extend=function(desitination,source) {
for (var m in source) {
desitination[m]=source[m]
}
return desitination;
};
var constructor=function(
container, /*需要绑定的marquee容器,可以传id,也可以也直接传dom 元素*/
freq, /*滚动的时间,单位秒*/
delay, /*两次滚动的间隔时间,单位秒*/
style /*marquee元素的样式*/
) {
var self=this;
var stoped=false;
var rollTimeoutId=null;
container=(typeof container=='string'?document.getElementById(container):container);
style=_extend({
width:'100%',
height:'15px'
},style || {});
for (var s in style) {
container.style.s=style[s];
}
var _roll=function() {
if (!stoped) {
rollTimeoutId=setTimeout(_stop,freq*1000);
} else {
rollTimeoutId=setTimeout(_start,delay*1000);
}
};
var _start=function() {
stoped=false;
container.start();
_roll();
};
var _stop=function() {
stoped=true;
container.stop();
_roll();
};
_roll();
};
return constructor;
})();
/*示例代码*/
window.onload=function() {
new RollAd('rollAd',3,4);
}
</script>
</head>
<body>
<marquee direction="up" behavior="scroll" scrollamount="1" scrolldelay="15" id="rollAd">
dfdfasfdsa <br />
dfdfd<br />
dfdfdf<br />
dfdfdf<br />
</marquee>
</body>
</html>