Assad Nazar
Assad Nazar

Reputation: 1464

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

Upvotes: 1

Views: 23359

Answers (1)

Andy E
Andy E

Reputation: 344733

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.

Upvotes: 10

Related Questions