Skip to content

Commit

Permalink
Ensure links to nonexistent elements don't trigger scroll. Fixes #92.
Browse files Browse the repository at this point in the history
  • Loading branch information
kswedberg committed Jan 23, 2016
1 parent b192367 commit b37f577
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jquery.smooth-scroll.js
Expand Up @@ -148,6 +148,10 @@
var pathMatch = thisOpts.scrollTarget || (linkPath === locationPath);
var thisHash = escapeSelector(link.hash);

if (thisHash && !$(thisHash).length) {
include = false;
}

if (!thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash)) {
include = false;
} else {
Expand Down

0 comments on commit b37f577

Please sign in to comment.