user1096057
user1096057

Reputation: 2423

Javascript menu onclick doesn't work

I have created an expand / collapse menu on a site I created in Wordpress

http://www.ogormanconstruction.co.uk/

Once you click on any of the li's the URL changes but the page does not seem to refresh to display the correct content

I'm not too familiar with javascript so I was wondering how I could make this effect work

<script type='text/javascript' src="/wp-content/themes/child/scripts/jquery-1.6.2.min.js"></script>
<script type='text/javascript' src="/wp-content/themes/child/scripts/jMaster.js"></script>
<script type='text/javascript' src="/wp-content/themes/child/scripts/supersleight.plugin.js"></script>
<script type="text/javascript" src="/wp-content/themes/child/scripts/hashchange.js"></script>
<script type="text/javascript" src="/wp-content/themes/child/scripts/actions.js"></script>
<script type="text/javascript" src="/wp-content/themes/child/scripts/tinyscroll.js"></script>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
</head>

<body <?php body_class(); ?>>

<div id="header">
            <ul id="nav">
                <li class="clearfix">
                    <div class="clearfix">
                        <div id="menuNav"><a href="#" class="openNav">Menu</a></div>
                        <ul class='clearfix'><li><strong>O'Gorman Construction Ltd</strong><ul class='clearfix'><li><a href='/about-us'>About Us</a><li><a href='/contact'>Contact</a></li></li><li><a href='/work'>Work</a></li><li><a href='/recruitment'>Recruitment</a></li></ul></li><li><strong>Services</strong><ul class='clearfix'><li><a href='/site-logistics'>Labour Supply</a></li><li><a href='/waste-management'>Drainage</a></li><li><a href='/security-services'>Fencing</a></li><li><a href='/traffic-management'>Demolition</a></li></ul></li><li><strong>&nbsp;</strong><ul><li><a href='/multi-service-gangs'>Ground Works</a></li><li><a href='/facilities-accomodation'>Multiservice Gangs</a></li><li><a href='/small-works-maintenance'>Engineering</a></li><li><a href='/catering-services'>Water Treatment</a></li></ul></li></ul>
                    </div>
                    </div>
                </li>
            </ul>
            <a href="/" id="logo"></a>
        </div>

<h2>Work</h2>
<div class="leftCol">
<div class="rightCol gallery">
    <ul id="homeGallery">
<li id="prevControl"><a href="#">Previous</a></li>
        <li id="galleryItems">

                    <ul>

                    <li>
                        <div class="galleryImage"><img src='/wp-content/themes/child/images/1.jpg' /></div>
                        <div class="galleryText"><div class="leftCol noborder" style="text-align: left;"><strong>Project I</strong></div></div>
                    </li>

                    <li>
                        <div class="galleryImage"><img src='/wp-content/themes/child/images/2.jpg' /></div>
                        <div class="galleryText"><div class="leftCol noborder" style="text-align: left;"><strong>Project II</strong></div></div>
                    </li>

                    <li>
                        <div class="galleryImage"><img src='/wp-content/themes/child/images/4.jpg' /></div>
                        <div class="galleryText"><div class="leftCol noborder" style="text-align: left;"><strong>Project III</strong></div></div>
                    </li>

                    </ul>

        </li>

<li id="nextControl"><a href="#">Next</a></li>
        <li id="copyright">&copy; O'Gorman Construction Ltd</li>
    </ul>
</div>
</div>


    <div id="main">

Upvotes: 1

Views: 862

Answers (1)

Mikey G
Mikey G

Reputation: 3491

It looks like it has to with $(window).hashchange(); which you are calling in the

$(document).ready(function ()

I think it is causing all of the links in your page to add a hash rather than redirect to another url.

For example, if you hover over the "Work" link, you can see the url it's supposed to go to in the bottom left corner:

http://www.ogormanconstruction.co.uk/work

But when you click on it, all that happens is the url is changed to:

http://www.ogormanconstruction.co.uk/#/work

which doesn't actually redirect you.

Is hashchange part of Wordpress, or is something you'ved added?

Upvotes: 1

Related Questions