悬停到暂停字幕 [英] Hover Over to Pause Marquee

查看:157
本文介绍了悬停到暂停字幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个滚动条滚动一些新闻文章,但当用户悬停在我需要它暂停,当用户悬停在它(onMouseOut)我需要启动备份。这不起作用:

I want to create a Marquee that scrolls some news articles but when the user hovers over it I need it to pause and when the user hovers out of it (onMouseOut) I need to ti start back up. This did not work:

<marquee onMouseOver="this.stop()" onMouseOut="this.start()">Text</marquee>

有没有人有任何建议,如何在最小的代码? >

Does anyone have any suggestions on how I can achieve this in a minimal amount of code?

推荐答案

我只是对这种欢笑感兴趣,因为我没有看到任何人在YEARS中使用marquee标签

I'm only anwering this out hilarity because I havent seen anyone use the marquee tag in YEARS

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

Had to look it up, but the marquee tag has an attribute called "scrollamount" which controls how fast it goes. So all we need to do is set the value to 0 when we hover in and set it back to 5 when we mouse out.

DEMO: http://jsfiddle.net/U9yFj/

$(function() {
    $('marquee').mouseover(function() {
        $(this).attr('scrollamount',0);
    }).mouseout(function() {
         $(this).attr('scrollamount',5);
    });
});

我希望我有这个

这篇关于悬停到暂停字幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆