Skip to content

Commit

Permalink
demo(all): fix demo scrolling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Jan 25, 2014
1 parent 1078573 commit ab054c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions misc/demo/assets/smoothscroll-angular-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ var linkHandler = function(ev) {
// most browser don't update :target when the history api is used:
// THIS IS A BUG FROM THE BROWSERS.
// change the scrolling duration in this call
smoothScroll(document.getElementById(this.hash.substring(1)), 500, function(el) {
var targetEl = document.getElementById(this.hash.substring(1));
if (targetEl) {
smoothScroll(document.getElementById(this.hash.substring(1)), 500, function(el) {
location.replace('#' + el.id)
// this will cause the :target to be activated.
});
});
}
}

// We look for all the internal links in the documents and attach the smoothscroll function
Expand Down
4 changes: 2 additions & 2 deletions misc/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
</div>
<nav class="hidden-xs">
<ul class="nav navbar-nav">
<a href="#" role="button" class="navbar-brand">
<a href="#top" role="button" class="navbar-brand">
UI Bootstrap
</a>
<li class="dropdown">
<a href="#" role="button" class="dropdown-toggle">
<a role="button" class="dropdown-toggle">
Directives <b class="caret"></b>
</a>
<ul class="dropdown-menu">
Expand Down

0 comments on commit ab054c9

Please sign in to comment.