Skip to content

Commit 61d1e74

Browse files
authored
Merge pull request cferdinandi#459 from cferdinandi/bugfix
Bugfix
2 parents 2e3e743 + 82de06c commit 61d1e74

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

dist/smooth-scroll.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* smooth-scroll v15.2.0
2+
* smooth-scroll v15.2.1
33
* Animate scrolling to anchor links
44
* (c) 2019 Chris Ferdinandi
55
* MIT License
@@ -281,7 +281,7 @@
281281

282282
// Get the hash to use
283283
var hash = window.location.hash;
284-
hash = hash ? hash : window.pageYOffset;
284+
hash = hash ? hash : '';
285285

286286
// Set a default history
287287
history.replaceState(
@@ -550,7 +550,7 @@
550550

551551
// Get the anchor
552552
var anchor = history.state.anchor;
553-
if (anchor && anchor !== 0) {
553+
if (typeof anchor === 'string' && anchor) {
554554
anchor = document.querySelector(escapeCharacters(history.state.anchor));
555555
if (!anchor) return;
556556
}

dist/smooth-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/smooth-scroll.polyfills.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* smooth-scroll v15.2.0
2+
* smooth-scroll v15.2.1
33
* Animate scrolling to anchor links
44
* (c) 2019 Chris Ferdinandi
55
* MIT License
@@ -351,7 +351,7 @@ if (window.Element && !Element.prototype.closest) {
351351

352352
// Get the hash to use
353353
var hash = window.location.hash;
354-
hash = hash ? hash : window.pageYOffset;
354+
hash = hash ? hash : '';
355355

356356
// Set a default history
357357
history.replaceState(
@@ -620,7 +620,7 @@ if (window.Element && !Element.prototype.closest) {
620620

621621
// Get the anchor
622622
var anchor = history.state.anchor;
623-
if (anchor && anchor !== 0) {
623+
if (typeof anchor === 'string' && anchor) {
624624
anchor = document.querySelector(escapeCharacters(history.state.anchor));
625625
if (!anchor) return;
626626
}

0 commit comments

Comments
 (0)