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 */
(function () {
var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) {
var scrollPoint = patternsNav.scrollTop
window.onunload = function () {
window.onunload = function () {
var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) {
var scrollPoint = patternsNav.scrollTop
localStorage.setItem('scrollPoint', scrollPoint)
}
}
window.addEventListener('DOMContentLoaded', function () {
if (window.location.href.indexOf('patterns/') !== -1) {
scrollPoint = parseInt(localStorage.getItem('scrollPoint'))
} else {
scrollPoint = 0
if (document.getElementById('patterns-nav')) {
if (window.location.href.indexOf('patterns/') !== -1) {
document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
} else {
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 */
(function () {
var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) {
var scrollPoint = patternsNav.scrollTop
window.onunload = function () {
window.onunload = function () {
var patternsNav = document.getElementById('patterns-nav')
if (patternsNav) {
var scrollPoint = patternsNav.scrollTop
localStorage.setItem('scrollPoint', scrollPoint)
}
}
window.addEventListener('DOMContentLoaded', function () {
if (window.location.href.indexOf('patterns/') !== -1) {
scrollPoint = parseInt(localStorage.getItem('scrollPoint'))
} else {
scrollPoint = 0
if (document.getElementById('patterns-nav')) {
if (window.location.href.indexOf('patterns/') !== -1) {
document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
} else {
document.getElementById('patterns-nav').scrollTop = 0
}
}
})
}());