Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

Making Smart Menu's work with Prototype javascript library

Home Forums Older releases 0.9.x Making Smart Menu's work with Prototype javascript library

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1333
    max
    Participant

    Side note, I have some old code that uses the Prototype library.
    Prototype uses the “$” to declare Javascript objects which conflicts with Jquery and prevented my smartmenu from running

    (see http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/)

    I did the following to fix this problem.

    First I load prototype and then I load jquery




    Now I took "jquery.smartmenus.min.js" and with editor I replaced each occurrence of
    "$" with "$j". Just like above.

    And now both my old prototype stuff works in my smartmenu stuff works

    #1614
    admin
    Keymaster

    Hi,

    Actually, you don’t need to edit jquery.smartmenus.min.js at all, you can use the stock version. It doesn’t use $ but jQuery and when you add this:

    var $j = jQuery.noConflict();

    jQuery will free the $ variable but will keep jQuery so you could still use any plugins (that are properly coded to not rely on $) without any modifications. But yes, for the initialization lines, you would need to replace $ with $j or jQuery like you’ve done.

    Cheers!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.