]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Make Address Bar hiding conditional on no #Hash 961/head
authorEnigmaSolved <sean@enigmasolved.com>
Sat, 29 Sep 2012 03:16:20 +0000 (00:16 -0300)
committerEnigmaSolved <sean@enigmasolved.com>
Sat, 29 Sep 2012 03:16:20 +0000 (00:16 -0300)
If the user comes to a page via a deep link (eg, www.example.com/page/#anchor-on-page) we don't want the `scrollTo` to fire because it will prevent the page from staying at the anchor location (which is confusing, since the page would try to go to the anchor and then scroll up when the `scrollTo` fires). This commit remedies that via what should be a pretty standard, cross browser method (as far as I know). :)

vendor/assets/javascripts/foundation/app.js

index b637e2eef30d319e98ae50d1df5b6e2fd5e04a02..b3949e88c509c83a49163889f086ac8897b95e7a 100644 (file)
@@ -22,8 +22,8 @@
   // $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'both'});
   // $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'both'});
 
-  // Hide address bar on mobile devices
-  if (Modernizr.touch) {
+  // Hide address bar on mobile devices (except if #hash present, so we don't mess up deep linking).
+  if (Modernizr.touch && !window.location.hash) {
     $(window).load(function () {
       setTimeout(function () {
         window.scrollTo(0, 1);