diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-01-13 15:14:32 +0300 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-01-13 15:14:32 +0300 |
commit | 5140bd88247125e24090a45be920b509b0fcf958 (patch) | |
tree | 057d0d06a483f512571631cc1cdc36ed0039d056 /app | |
parent | b1792d9e4c28366ecc896e36d22099ab564c150f (diff) |
When anchor is clicked set the correct condition.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/project_show.js.coffee | 8 | ||||
-rw-r--r-- | app/assets/javascripts/tree_show.js.coffee | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee index 73818ecd0ed..581bd2edc20 100644 --- a/app/assets/javascripts/project_show.js.coffee +++ b/app/assets/javascripts/project_show.js.coffee @@ -21,10 +21,12 @@ $(document).ready -> $("html, body").animate scrollTop: $(".navbar").offset().top - $(".navbar").height() , 200 - false - $("a").click (e) -> - unless location.hash is "" + $("a").click (event) -> + link = event.target + isAnchor = link instanceof HTMLAnchorElement + + if (location.hash != "" || isAnchor) $("html,body").animate scrollTop: $(this).offset().top - $(".navbar").height() - 3 , 200 diff --git a/app/assets/javascripts/tree_show.js.coffee b/app/assets/javascripts/tree_show.js.coffee index 33300643dc4..ee43638c4b2 100644 --- a/app/assets/javascripts/tree_show.js.coffee +++ b/app/assets/javascripts/tree_show.js.coffee @@ -5,10 +5,12 @@ $(document).ready -> $("html, body").animate scrollTop: $(".navbar").offset().top - $(".navbar").height() , 200 - false - $("a").click (e) -> - unless location.hash is "" + $("a").click (event) -> + link = event.target + isAnchor = link instanceof HTMLAnchorElement + + if (location.hash != "" || isAnchor) $("html,body").animate scrollTop: $(this).offset().top - $(".navbar").height() - 3 , 200 |