2012-02-08 16 views
0

當您將鼠標懸停在我網站上的鏈接上時,它會顯示正確的URL,但是一旦您點擊它,它就會添加一個#以防止加載正確的頁面。如何在我的網站上禁用hashchange:禁用hashchange

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

<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="javascript: void(0)" 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"> 

我想我需要編輯位actions.js內,但我不知道我需要改變

$(window).hashchange(); 
}); 

function runSetups() { 
    interceptLinks(); 
    setupHomeGallery(); 
    setupProjects(); 
    setupProject(); 
    setupNews(); 
    setupBackToTop(); 
    setupStickies(); 
} 

function setupWindowEvents() { 
    $(window).scroll(checkScrolling); 

    $(window).hashchange(function() { 
     var hash = location.hash; 

     loadContent(hash.substr(1)); 
    }); 

    $(document).mousemove(function (event) { 
     var mx = event.pageX; 
     var my = event.pageY; 

     if ($('#menuNav.open').length > 0) { 
      if (my > $('#header').outerHeight() + 70) { 
       $('#menuNav .closeNav').trigger('click'); 
       $('#menuNav').removeClass('open'); 
      } 
     } 
    }); 
+0

修復此代碼:'$(窗口).hashchange(函數(){VAR 哈希=的location.hash; loadContent(hash.substr(1)); });'如何?這是 依賴... – gdoron 2012-02-08 10:05:04

+0

取決於什麼? – user1096057 2012-02-08 10:10:44

+0

你想要什麼。您可以使用'XMLHttpRequest'來加載適當的內容並替換舊的內容。 – 2012-02-08 10:39:40

回答

0

你的問題不在於你的script.js,而在於你的action.js中你的href被加載到這個函數的loadContent(url)中。然後你的href將被轉換爲一個帶有location.hash的散列鏈接。你有幾個選擇在這裏..你可以刪除該功能,如果你不使用它,改變location.hash到window.location,或者只是通過省略'/'來改變你的href。

這真的取決於你想要做什麼。