My app already has a completed menu using jquery.menu.js found at http://wiki.jqueryui.com/Menu.
I'm now also trying to add the jquery autocomplete widget from jquery ui 1.8.1 - but both of these have a .menu() function that conflicts with each other.
If I put jquery-ui-1.8.1.custom.js first in the head, then autocomplete works b开发者_如何学编程ut the menu does not. If I put jquery-menu.js first in the head, then the menu works but autocomplete doesnt.
Is there a way to solve this without editing either plugin? (If I edit, I will probably lose those changes the next time either plugin is upgraded)
Since they both extend the jQuery object with a function named menu
, there's no other way than to edit one of them to rename it. Reading through the commments, it appears that the code in autocomplete is the genesis of the future menu widget in jQuery UI. I'd suggest that you modify the menu widget code to rename the function, with the thought that you'd simply throw it away when 1.9 is released (as seems to be the plan) with an official menu widget.
without editing - you could include code between the 2 to remap 'menu' to something else.
精彩评论