问题描述
使用以下HTML代码段横向滚动文本: < marquee behavior =scroll direction =leftonmouseover =this.start(); onmouseout =this.stop();>继续......将鼠标悬停在我身上!< / marquee>
我遇到的问题是,一旦您访问该页面,字幕
开始自动滚动。我想要做的是冻结 marquee
,直到你使用鼠标悬停为止。
你可以用scrollAmount来修饰,而不是调用start()和stop(),并且最初将scrollamount设置为0。例如
< marquee behavior =scrolldirection =leftscrollamount =0onmouseover =this.scrollAmount = 6onmouseout < / marquee>
请参阅
I'm using the following HTML piece of code to scroll text horizontally:
<marquee behavior="scroll" direction="left" onmouseover="this.start();" onmouseout="this.stop();">Go on... hover over me!</marquee>
The issue I have is that once you visit the page, the marquee
starts scrolling automatically. What I want to do, is to freeze the marquee
until you mouseover.
You could tinker with scrollAmount instead of calling start() and stop(), and just set scrollamount to 0 initially. E.g.
<marquee behavior="scroll" direction="left" scrollamount="0" onmouseover="this.scrollAmount = 6" onmouseout="this.scrollAmount = 0">Go on... hover over me!</marquee>
See http://jsfiddle.net/svt9L/
这篇关于HTML / JavaScript:如何停止选取框加载,并开始在鼠标悬停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!