Lukeluha
Lukeluha

Reputation: 263

Page using jQuery displays bad in Firefox (IE and Chrome ok)

i am learning jQuery from tusplus website and i want to have a FAQ section with questions and when user point to the question, the right answer slided down.

I've implemented it but it works good only in IE and Chrome, but bad in Mozilla. Anyone know why? Thanks.

Live demo: www.lukashamrla.cz/pokus.html

Code:

        $(document).ready(function(){
            $("dd").addClass("hide");

            $("dt").on("mouseenter", function(){
                $(this).next().slideDown().siblings('dd').slideUp();
            })
        });

Upvotes: 2

Views: 57

Answers (1)

MackieeE
MackieeE

Reputation: 11862

I believe it's the .siblings('dd') that may be mis-behaving, tweak this to slideUp() only of those that are hidden via :visible to prevent .slideUp() actioning dd elements regardless of it's status:

$("dd").addClass("hide");
$("dt").on("mouseenter", function () {
    $(this).next().slideDown().siblings('dd:visible').slideUp();
});

Demo Fiddle: http://jsfiddle.net/Lsy9v/

Upvotes: 2

Related Questions