19

いくつかのニュース記事をスクロールするマーキーを作成したいのですが、ユーザーがその上にカーソルを合わせると一時停止し、ユーザーがその上にカーソルを合わせると(onMouseOut)バックアップを開始する必要があります。これは機能しませんでした:

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

最小限のコードでこれを達成する方法について誰かが何か提案がありますか?

4

7 に答える 7

41
<marquee onmouseover="this.stop();" onmouseout="this.start();">
my text here
</marquee>

間違ったケースを使用しています:onMouseOver、onMouseOut

于 2014-07-30T06:52:48.077 に答える
22

マーキータグには、実行scrollamount速度を制御するという属性があります。ホバーインしたときに値を設定し、0マウスアウトしたときに値を戻す5だけです。

デモ:http: //jsfiddle.net/U9yFj/

$(function() {
    $('marquee').mouseover(function() {
        $(this).attr('scrollamount',0);
    }).mouseout(function() {
         $(this).attr('scrollamount',5);
    });
});
于 2011-09-17T04:40:53.193 に答える
12

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

于 2019-06-10T20:48:40.947 に答える
4
<marquee behavior="scroll" scrollamount="5" direction="left" onmouseover="this.setAttribute('scrollamount',0);" onmouseout="this.setAttribute('scrollamount',5);">
 Your name, your address, your details scrolling through line
</marquee>

このコードがMARQUEEタグを使用している人に役立つことを願っています。

于 2015-11-10T04:19:05.303 に答える
2
<marquee id="mq" direction="right" loop="true" onmouseover="this.stop();" onmouseout="this.start();">
    <a href="http://google.com">Google</a>
    <input type="text" id="txt" />
    <input type="button" id="btn" value="Click here" onclick="alert(txt.value);" />
    Some other text here</marquee>
于 2017-05-03T13:36:01.733 に答える
0

HTMLマーキーマークアップを次のように使用するだけです。

onmouseover="stop()"

に続く

onmouseout="start()"
于 2018-06-01T13:39:35.323 に答える
0

;を閉じた後、コードに追加する必要があります()

于 2019-04-05T12:14:15.127 に答える