I don't even know how your code works for most people. It shouldn't work. For instance, you have the giant JS var called simplemenu at the bottom containing the HTML for the menu. Then at the very top of simplemenu.js you have this:

var menu = $(simplemenu).attr("id", "simplemenu").addClass('clear-block');

You can't do this, it make absolutely no sense. jQuery takes a selector for the parameter, you can't just pass it a bunch of HTML as a string. Attached is a correctly written simplemenu.js.

Comments

jcready’s picture

StatusFileSize
new1.22 KB

Edit: Changed "$(element).appendTo(simplemenu);" to "$(element).append(simplemenu);"

zroger’s picture

Status: Active » Postponed (maintainer needs more info)

jQuery takes a selector for the parameter, you can't just pass it a bunch of HTML as a string.

jQuery can take more than just a selector as a parameter. Among other things it can take a string of html, which in turn creates DOM elements from the html string which can then be inserted into the document or manipulated just like any other elements.

jcready’s picture

@Roger López: You are correct sir, I retract my previous issue. But now I have another.

At the top of simplemenu.js you have:
var menu = $(simplemenu).attr("id", "simplemenu").addClass('clear-block');

Then later in the code you have:
$(menu).superfish( { blah, blah, blah... } );

So you're passing a jQuery object into another jQuery object...
Shouldn't the code be just menu.superfish( { blah, blah, blah... } ); since menu is already a jQuery object.

zroger’s picture

true. jQuery is smart enough to realize that the argument is already a jQuery object, but for correctness and performance, you are correct.

eric_a’s picture

Actually, it looks like menu is *not* an object all the time. When theme exclusion is used, simplemenu does not exist in those themes... Internet Explorer and Firefox are throwing errors and the error possibly breaking stuff in IE, but I guess this is a seperate issue.

AlexisWilke’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Status: Postponed (maintainer needs more info) » Fixed

This is fixed in 1.x-dev. I do not support 2.x so please, switch back to 1.x if you have the time to do so.

Thank you.
Alexis Wilke

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.