jQuery Toggle (IE 7)
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/
精彩评论