fixed scrollTop error

This commit is contained in:
Heydon Pickering 2017-07-31 21:07:38 +01:00
parent e267e4e7f9
commit 17dd654f02
5 changed files with 1039 additions and 1393 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,19 +31,21 @@
/* persist navigation scroll point */ /* persist navigation scroll point */
(function () { (function () {
window.onunload = function () {
var patternsNav = document.getElementById('patterns-nav') var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) { if (patternsNav) {
var scrollPoint = patternsNav.scrollTop var scrollPoint = patternsNav.scrollTop
window.onunload = function () {
localStorage.setItem('scrollPoint', scrollPoint) localStorage.setItem('scrollPoint', scrollPoint)
} }
} }
window.addEventListener('DOMContentLoaded', function () { window.addEventListener('DOMContentLoaded', function () {
if (document.getElementById('patterns-nav')) {
if (window.location.href.indexOf('patterns/') !== -1) { if (window.location.href.indexOf('patterns/') !== -1) {
scrollPoint = parseInt(localStorage.getItem('scrollPoint')) document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
} else { } else {
scrollPoint = 0 document.getElementById('patterns-nav').scrollTop = 0
}
} }
}) })
}()); }());

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -31,19 +31,21 @@
/* persist navigation scroll point */ /* persist navigation scroll point */
(function () { (function () {
window.onunload = function () {
var patternsNav = document.getElementById('patterns-nav') var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) { if (patternsNav) {
var scrollPoint = patternsNav.scrollTop var scrollPoint = patternsNav.scrollTop
window.onunload = function () {
localStorage.setItem('scrollPoint', scrollPoint) localStorage.setItem('scrollPoint', scrollPoint)
} }
} }
window.addEventListener('DOMContentLoaded', function () { window.addEventListener('DOMContentLoaded', function () {
if (document.getElementById('patterns-nav')) {
if (window.location.href.indexOf('patterns/') !== -1) { if (window.location.href.indexOf('patterns/') !== -1) {
scrollPoint = parseInt(localStorage.getItem('scrollPoint')) document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
} else { } else {
scrollPoint = 0 document.getElementById('patterns-nav').scrollTop = 0
}
} }
}) })
}()); }());