Commit: f0a599b5d062e782469e8bbde2dbf2f8db835dc4 Author: Dejan Marjanovic <[email protected]> Sat, 23 Nov 2013 03:32:26 +0100 Parents: e80825e1c16de218febe4a7351088f04aa52edbe Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=f0a599b5d062e782469e8bbde2dbf2f8db835dc4 Log: Fix navbar issue when # scroll is used Changed paths: M js/common.js Diff: diff --git a/js/common.js b/js/common.js index 538c56f..dac7951 100755 --- a/js/common.js +++ b/js/common.js @@ -215,6 +215,30 @@ $(document).ready(function() { language: getLanguage(), limit: 3 }); + + // Hash scroll + var jHtmlBody = $('html, body'); + function scroll(target, interval) + { + if ( ! interval && interval !== 0) + interval = 400; + + jHtmlBody.animate({ + scrollTop: $(target).offset().top - 52 + }, interval); + return false; + } + + if (window.location.hash) + scroll(window.location.hash, 0) + + $('a[href^=#]').click(function(e){ + e.preventDefault(); + var hash = $.attr(this, 'href'); + scroll(hash); + window.location.hash = hash; + }); + }); /** -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
