将鼠标悬停在Pause Marquee上

How*_*Gee 12 html javascript css jquery marquee

我想创建一个滚动一些新闻文章的Marquee,但是当用户将鼠标悬停在它上面时,我需要它暂停,当用户将其悬停时(onMouseOut)我需要重新启动.这不起作用:

<marquee onMouseOver="this.stop()" onMouseOut="this.start()">Text</marquee>
Run Code Online (Sandbox Code Playgroud)

有没有人对如何在最少量的代码中实现这一点有任何建议?

Leo*_*Leo 30

<marquee onmouseover="this.stop();" onmouseout="this.start();">
my text here
</marquee>
Run Code Online (Sandbox Code Playgroud)

您使用的是错误的案例:onMouseOver,onMouseOut


wes*_*bos 18

我只是在欢呼这个狂欢,因为我没有看到任何人在YEARS中使用marquee标签

不得不查找,但marquee标签有一个名为"scrollamount"的属性,它控制它的速度.所以我们需要做的就是当我们悬停时将值设置为0,并在我们鼠标移出时将其设置为5.

演示:http: //jsfiddle.net/U9yFj/

$(function() {
    $('marquee').mouseover(function() {
        $(this).attr('scrollamount',0);
    }).mouseout(function() {
         $(this).attr('scrollamount',5);
    });
});
Run Code Online (Sandbox Code Playgroud)

我希望我为此疯狂起来


小智 10

<marquee behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">
    Go on... hover me (and hold the mouse over)!
</marquee>
Run Code Online (Sandbox Code Playgroud)