いくつかのニュース記事をスクロールするマーキーを作成したいのですが、ユーザーがその上にカーソルを合わせると一時停止し、ユーザーがその上にカーソルを合わせると(onMouseOut)バックアップを開始する必要があります。これは機能しませんでした:
<marquee onMouseOver="this.stop()" onMouseOut="this.start()">Text</marquee>
最小限のコードでこれを達成する方法について誰かが何か提案がありますか?
いくつかのニュース記事をスクロールするマーキーを作成したいのですが、ユーザーがその上にカーソルを合わせると一時停止し、ユーザーがその上にカーソルを合わせると(onMouseOut)バックアップを開始する必要があります。これは機能しませんでした:
<marquee onMouseOver="this.stop()" onMouseOut="this.start()">Text</marquee>
最小限のコードでこれを達成する方法について誰かが何か提案がありますか?
<marquee onmouseover="this.stop();" onmouseout="this.start();">
my text here
</marquee>
間違ったケースを使用しています:onMouseOver、onMouseOut
マーキータグには、実行scrollamount
速度を制御するという属性があります。ホバーインしたときに値を設定し、0
マウスアウトしたときに値を戻す5
だけです。
デモ:http: //jsfiddle.net/U9yFj/
$(function() {
$('marquee').mouseover(function() {
$(this).attr('scrollamount',0);
}).mouseout(function() {
$(this).attr('scrollamount',5);
});
});
<marquee behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">
Go on... hover me (and hold the mouse over)!
</marquee>
<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タグを使用している人に役立つことを願っています。
<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>
HTMLマーキーマークアップを次のように使用するだけです。
onmouseover="stop()"
に続く
onmouseout="start()"
;
を閉じた後、コードに追加する必要があります()
。