开发者

stop marquee on mouseover and play on mouseout

I am using the conventional marquee html tag in my site:

<marquee direction="left"><div id="logo-scroll">
    <ul id="clients-logos">
        <li><a href="#"><img src="images/logos/alcatel.jpg" alt="Alcatel" /></开发者_如何学编程a></li>
        <li><a href="#">abs</a></li>
    </ul>
 </div></marquee>

how can i pause marquee through jquery on mouseover and mouseout events keeping in mind that i want to work with marquee tag not jquery script.

Thanks


Use the start and stop methods:

$("marquee").hover(function () { 
    this.stop();
}, function () {
    this.start();
});

Working demo: http://jsfiddle.net/ZWQqc/

Just noticed your last line — jQuery provides the mouseenter event to non-IE browsers here, making life much easier. You should keep your JavaScript separate from your HTML because it's much easier to maintain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜