The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery Conflict with Link Selection and Menu Initiation

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #28732


    I’m having some trouble with a jQuery powered dropdown menu I have on my website. I’ve tried and tried and can’t seem to figure out a working solution. Any help would be greatly appreciated. Thank you in advance!

    You can either watch the video I made on youtube describing the issue:

    or keep reading.

    The website is

    When you go to the website, try to view an interior page with the top left menu, like ‘ABOUT’, ‘RESERVATIONS’, ‘SERVICES’ or one of the others, you will then be required to ‘Please Select a Location to Continue’. Once you select a location, either ‘Hampton Roads, VA’ or ‘Savannah, GA’ will load their appropriate stylesheet (and content). However, it also initiates the JQuery powered toggle function that makes the drop down location menu appear, which is not correct. The drop down location menu should only appear if someone selects the ‘Change Location’ button link at the top right of the website.

    Here is the .js code:

    * Styleswitch stylesheet switcher built on jQuery
    * Under an Attribution, Share Alike License
    * By Kelvin Luck ( )

    // Take content in a div with id=”defer-xyz” and move it to a div with id=”xyz”
    function relocateDeferredContent() {
    var divs=document.getElementsByTagName(“div”);
    var replacements=new Array();
    for(var i2=0;i2
    function createCookie(name,value,days)
    if (days)
    var date = new Date();
    var expires = "; expires="+date.toGMTString();
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
    function readCookie(name)
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } // /cookie functions

    Here is the page.php code:



    Thanks but that didn’t work.

    I tried adding:

    $(“#changeThemeWrap”).css(“marginTop”, “-180px”)


    animateUp = function () {
    marginTop: “-180px”

    in the .js file but it still continues to initiate the animateDown function on the #changeThemeWrap div when a location (either Hampton Roads or Savannah) is selected from within the page.php. What I think the problem is the styleswitch function is triggering the animateDown and animateUp functions in the dropdown. Which works great when the user changes their location from the ‘Change Location’ dropdown because we want it to animateUp after they make their selection. However, when visitors use the other ‘Please Select a Location’ link in the page.php file, because it uses the same styleswitch function that is triggering the animate sequence, it’s causing a problem by triggering an animateDown with the ‘Change Location’ (#changeThemeWrap) menu. Figuring out the best way to have the styleswitch function change the website theme (or location) with only triggering the animateUp and animateDown function if they use the ‘Change Location’ menu is where I’m having trouble deciding how to make it work.

    Thanks again for your help and input.


    Hi b-rad,

    Not sure if you noticed, but you’re loading jQuery multiple times. This causes all kinds of problems. It’s being called once in your header and again in the body.

    Check out this article

    Give that a try and let us know if it resolves the problem.


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