关于文字跑马灯暂停的问题请教
刚接触javascript,现有现成的跑马灯效果代码.想实现当鼠标移到文字上的时候,文字停顿,需要加什么代码.谢谢!
原始代码:
<script language="JavaScript1.2">
//设置marquee的宽度 (in pixels)
var marqueewidth=400
//设置marquee的高度 (in pixels, 该参数只适用于NS)
var marqueeheight=20
//设置marquee滚动的速度(数值大速度快)
var speed=4
//设置marquee显示内容,使用标准的HTML语法。
var marqueecontents='<strong><big>欢迎光临<a href="http://hexun.com/zy551/default.html">551zy的个人空间</a>红梅 特效代码集锦 </big></strong></font>'
if (document.all)
document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}
function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>')
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.width
scrollit()
}
function scrollit(){
if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.left-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.left=marqueewidth
scrollit()
}
}
window.onload=regenerate2
</script>
<ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01">
<layer name="cmarquee02"></layer>
</ilayer>
...全文
相关推荐
文字自动滚动效果_俗称:文字跑马灯效果
滚动速度不宜过快,以免用户难以阅读;同时,应提供停止或暂停的选项,让用户有机会阅读完整的内容。总的来说,实现文字跑马灯效果的方式多样,可以根据项目需求和技术栈选择合适的方法。
vue文字跑马灯效果
前言 效果: 当鼠标移入跑马灯文字时,跑马灯文字暂停滚动,反之鼠标移出继续滚动。 知识点: substring(字符串截取) setInterval定时器(解决字符串持续截取与头尾拼接) clearInterval清除定时器(解决悬停暂停) ES6箭头函数(解决this指向) 代码实现 HTML: <div id="app"> <span @mouseout="start"...
jquery 文字跑马灯
**事件绑定**:使用`click()`、`mouseover()`等事件处理函数,可以增加交互性,如暂停、继续或改变跑马灯的滚动方向。6.
HTML5文字跑马灯动画特效
在跑马灯动画中,Splitting.js可以帮助我们轻松地控制每个文字的移动和闪烁。要实现HTML5文字跑马灯动画,我们需要以下几个步骤:1.
textview文字跑马灯
标签“文字跑马灯”表明这个自定义TextView主要是为了实现跑马灯效果。在实际应用中,可能需要添加一些额外功能,比如控制滚动速度、支持暂停/恢复滚动、设置滚动方向等。


