问题
silly question, but I've tried with and without javascript, and I don't seem to be able to stop the marquees by default.
Basically I want them to start moving on mousover, but to be stopped by default.
I've tried stuff like this:
$.each($('.tracks_marquee'),function(){$(this).stop();}); //triggered on $.ready
<marquee class="tracks_marquee"
behavior="alternate"
scrolldelay="160"
onmouseover="this.start();"
onmouseout="this.stop();"
onload="this.stop();">
some text here
</marquee>
but nothing works
回答1:
Try this
<marquee class="tracks_marquee" behavior="alternate" scrollamount="0" >
some text here
</marquee>
$(document).ready(function()
{
$(".tracks_marquee").hover
(
function()
{
$(this).attr("scrollamount","1");
$(this).start();
},
function()
{
$(this).attr("scrollamount","0");
$(this).stop();
}
)
})
Check this live in fiddle
http://jsfiddle.net/BM2Cq/
来源:https://stackoverflow.com/questions/9376216/marquee-stop-onload