TrepaNation~ Posted September 4, 2012 Share Posted September 4, 2012 Hello there. I am implementing a JavaSript menu into my company's website, but seemed to have run into a snag. An existing script on the page is interfering with the new JavaScript menu. It is the JGlideMenu found here: http://www.sonicradish.com/labs/jGlideMenu/current/index.htmlI am using the inline example found on their page. I have the menu placed in a PHP side bar that acts as a persistent navigation that is conditionally fixed. The sidebar uses JQuery to switch from a static postion to a fixed position when reaching a certain scroll point. The JGlideMenu works great until I do any scrolling of the page. At that point the menu no longer functions. Instead the "rel" link (#tile_002), which is the next "slide" of the menu is placed at the end of the url. You can check out our website here to see what I'm talking about: mlkishigo.com/home-2012.html If I disable the conditionally fixed jquery it corrects the problem with JGlideMenu. But obviously I need them both to work. Any advice you have would be VERY MUCH appreciated. And please let me know if you need any other info to trouble shoot this. Thanks! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 4, 2012 Share Posted September 4, 2012 This line: var $jx = jQuery.noConflict(); in the floating menu script causes the "$" object used by jQuery to become undefined, which causes the other script that relies on it to no longer work. That code runs when the page is scrolled. Link to comment Share on other sites More sharing options...
TrepaNation~ Posted September 4, 2012 Author Share Posted September 4, 2012 Thanks for the input! I am by no means a JavaScript programmer. I mostly just do html/css... So could you tell me what I would need to do to fix this? Link to comment Share on other sites More sharing options...
thescientist Posted September 4, 2012 Share Posted September 4, 2012 I would try taking that line out. Link to comment Share on other sites More sharing options...
TrepaNation~ Posted September 4, 2012 Author Share Posted September 4, 2012 Ok I commented out var $jx = jQuery.noConflict(); The JGlide menu now works when scrolled but the conditionally fixed persistent container (that the menu is contained in) no longer functions. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 4, 2012 Share Posted September 4, 2012 One or the other script will need to be rewritten. The scroll script is probably smaller, so you should replace any reference in that script to the variable "$jx" with the variable "$". Link to comment Share on other sites More sharing options...
TrepaNation~ Posted September 4, 2012 Author Share Posted September 4, 2012 Correct, the scroll script is much shorter. There were only 3 instances of "$jx" so I quickly changed them to "$". But it still had the same problem. The JGlide worked but no persistent scroll. I went on to change it to "$nc" (for no conflict) in case "$" was referenced elsewhere. Still broken. Any other ideas? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 4, 2012 Share Posted September 4, 2012 The variable name is not the problem, noConflict is the problem because it deletes the $ object that the other script needs. If you have any call at all to noConflict then that script will not work. You need to remove the noConflict line and use the normal "$" variable to refer to the jQuery object instead of the other variable that they use. Your updated code just uses a new variable name for the return value of noConflict. The variable name is not the problem, the use of noConflict is the problem. Link to comment Share on other sites More sharing options...
TrepaNation~ Posted September 4, 2012 Author Share Posted September 4, 2012 Thanks so much for the advice justsomeguy! Through your input I managed to get it to work!! Mind you I have absolutely no idea WHY it worked, because js is greek to me... What I did was change "$jx = jQuery.noConflict();" to "$jx = jQuery;". I checked the site and there are no adverse effects of making this change. If you know of some reason this is not good please let me know. But at this time I am a happy camper with things functioning as intended. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now