You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Check an href for an anchor. If exists, and in document, scroll to it. * If href argument omitted, assumes context (this) is HTML Element, * which will be the case when invoked by jQuery after an event */functionscroll_if_anchor(href){href=typeof(href)=="string" ? href : $(this).attr("href");// If href missing, ignoreif(!href)return;// You could easily calculate this dynamically if you prefervarfromTop=50;// If our Href points to a valid, non-empty anchor, and is on the same page (e.g. #foo)// Legacy jQuery and IE7 may have issues: http://stackoverflow.com/q/1593174var$target=$(href);// Older browsers without pushState might flicker here, as they momentarily// jump to the wrong position (IE < 10)if($target.length){$('html, body').animate({scrollTop: $target.offset().top-fromTop});if(history&&"pushState"inhistory){history.pushState({},document.title,window.location.pathname+href);returnfalse;}}}// When our page loads, check to see if it contains and anchorscroll_if_anchor(window.location.hash);// Intercept all anchor clicks$("body").on("click","a[href^='#']",scroll_if_anchor);
The text was updated successfully, but these errors were encountered:
Javascript:
The text was updated successfully, but these errors were encountered: