external links to id anchor not working - using jquery waypoints

Discussion in 'JavaScript Forum' started by Testuser2000, Apr 10, 2013.

  1. Testuser2000

    Testuser2000 New Member

    I am having an issue having an external page link to an id anchor on my index page. Every time I try to link to an anchor it just goes to the top of the page. It almost looks like it shows the page at the anchor for a split second but then just the top of the page.You can take a look here .. http://jointmedias.com/clients/misfit/site/All of the anchors work on the page but again can not link to a specific anchor from an external page. This should work http://jointmedias.com/clients/misfit/site/#p3 but it dosent.I am using this js script for the smooth scrolling (again it works perfect on the page itself)\[code\]$(document).ready(function(){$(window).scroll(function(){ var scrollTop = $("#topsec").height(); if($(window).scrollTop() >= scrollTop){ $('#nav').css({ position : 'fixed', top : '0' }); } if($(window).scrollTop() < scrollTop){ $('#nav').removeAttr('style'); }})})$('a[href*=#]:not([href=http://stackoverflow.com/questions/15914523/#])').click(function() {if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 2000,'easeInOutCubic'); return false; }}});\[/code\]I am too new to JS to know if this has something to do with it or not.. any help would be much appreciated. Thanks for taking a look.Brian
     

Share This Page