Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That code appears to be changing the background color in the <code>onmouseout</code> handler. If this reverts the color to what it was, try not handling that event to see if it stays the same.</p> <p><strong>Edit:</strong> Setting the handler to the empty string doesn't look right. See <a href="https://stackoverflow.com/questions/209029/best-way-to-remove-an-event-handler-in-jquery">Best way to remove an event handler in jQuery?</a></p> <p><strong>Edit:</strong></p> <p>Something like this might be better:</p> <pre><code>$(this).unbind('mouseleave'); </code></pre> <p>Or (according to the above link, this is the preferred approach):</p> <pre><code>$(this).off('mouseleave'); </code></pre> <p><strong>Edit:</strong></p> <p>For this to work you will need to remove the inline handlers you have set up for <code>onmouseover</code> and <code>onmouseout</code>. The reason for this is that <code>$(this).off('mouseleave');</code> won't work unless the events are wired up with jQuery, and <code>$(this).onmouseover= '';</code> won't work either for the same reason.</p> <p>You will then need to wire up the event handlers with some jQuery:</p> <pre><code>$('.navbtn').mouseover(function () { changeBGColor(this,'#b90707'); }); $('.navbtn').mouseout(function () { changeBGColor(this, ''); }); </code></pre> <p>Now where you are currently doing:</p> <pre><code>if(url == current ){ changeBGColor(this,'#b90707');changeColor(this,'#fff'); $(this).onmouseout = ''; $(this).onmouseover= ''; }; </code></pre> <p>You can instead do:</p> <pre><code>if(url == current ){ changeBGColor(this,'#b90707');changeColor(this,'#fff'); $('.navbtn').off('mouseout'); $('.navbtn').off('mouseover'); }; </code></pre> <p>Which should ensure that the colors you have just set stay that way.</p> <p>Note that jQuery 1.7+ is required for the <code>off</code> syntax to work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload