marquee stop onload

南笙酒味 提交于 2019-12-25 01:22:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!