1

The code below is suppose to have a menu which is hidden until #menubutton is clicked on, but clicking on it is not revealing the menu. It used to work but has stopped and I have no idea why. It works in Chrome but not in Firefox.

<a id='menubutton' href="#">
    <img src="/wp-content/themes/helpline/images/mobilemenu.png">
    <div id='menubuttontext'>
        Menu
    </div>
</a>
<ul id='menucontainer'>
    <li><a href='/'>Home</a></li>
    <li><a href='/services/'>Services</a></li>
    <li><a href='/about-us/'>About us</a></li>
    <li><a href='/procedures/'>Procedures</a></li>
    <li><a href='/call-back/'>Request a call back</a></li>
    <li><a href='/contact/'>Contact Us</a></li>
</ul>
<script type="text/javascript">
    var inout="0";
    $("#menubutton").click(function () {
        if(inout=="0"){
            $("#menucontainer").show("slow");
            inout="1";
        }else{
            $("#menucontainer").hide();
            inout="0";
        }
    });
</script>

CSS:

#menucontainer {
display: none;
}
Adam Ulivi
  • 85
  • 1
  • 11

2 Answers2

0

Make sure you are loading jQuery. Try adding this to your head tag:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

Here is a working example with jQuery loaded and your exact code (minus the image): http://jsfiddle.net/uyhvkphd/

deebs
  • 1,390
  • 10
  • 23
0

Thanks everyone. After other people tested it and it seemed to work, I realised it must be a browser issue. It works in other browsers, but Firefox doesn't like it.

This question explains why Jquery .show() not working in firefox

Community
  • 1
  • 1
Adam Ulivi
  • 85
  • 1
  • 11