Plugin doesn't work in IE 7. Any ideas?
I've tested this plugin in in every browser I can get my hands on (Opera, Firefox, Safari, IE), and on both Windows and Macs to boot, and it works in every single one except for IE 7. I cannot, for the life of me, figure out why.
The code is below, but if you want to check it out in inaction, just go
here and view it with IE 7 (or IE 8 in compatibility mode).
Any help would be greatly appreciated (also, this is my first jQuery plugin, so, even though it technically works, I could use some tips on making it better, too).
Thanks in advance.
-
jQuery.fn.panelize = function(options){
var defaults = {
hover: "over",
open: "open",
speedShow: 1000,
speedHide: 750,
};
var options = $.extend(defaults, options);
var panel = $(this).find('#panel');
var width = $(this).width();
var panels = new Array();
panel.each(function() {
var name = $(this).attr("class");
var height = $(this).height();
panels[name] = height;
$(this).hide().css({"height": 0}, {"width" : width });
});
var tab = $(this).find('#tab');
tab.each(function(){
$(this).css({ "cursor" : "pointer" });
});
tab.bind("click", function(event) {
var node = $(this);
var next = node.next();
if( node.hasClass(options.open) ){
node.toggleClass(options.open);
next.animate({height: 0}, {duration: options.speedHide, complete : function(){
next.hide();
} });
}
else {
var name = node.attr("class");
var height = panels[name];
node.toggleClass(options.open);
next.show().animate({height: height}, {duration: options.speedShow});
}
});
}