开发者

jQuery Toggle (IE 7)

开发者 https://www.devze.com 2023-01-26 18:20 出处:网络
Why wont this work in IE开发者_JAVA百科 7?Any help would be greatly appreciated! http://www.k-e-w-l.ca/slideToggle.phpI\'ve played around for a little bit and it seems you want to enable the click ac

Why wont this work in IE开发者_JAVA百科 7? Any help would be greatly appreciated!

http://www.k-e-w-l.ca/slideToggle.php


I've played around for a little bit and it seems you want to enable the click action on the link that is being clicked, rather than the li element.

$(document).ready(function() {
    $(".toggle_container").hide();

    $("li.trigger a").click(function() {
        $(".toggle_container").hide();
        $(this).toggleClass("active").next().slideToggle("slow");
    });

});

$ is just an alias for jQuery

There's also a problem with your HTML, in that you have divs as children of your ul element. You can just have another ul within the list item itself. As another point, an ID should be unique for each DOM element.

I've put this up as a jsFiddle here: http://jsfiddle.net/8q8jy/1/

0

精彩评论

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