fixed scrollTop error
This commit is contained in:
parent
e267e4e7f9
commit
17dd654f02
File diff suppressed because it is too large
Load Diff
|
@ -31,19 +31,21 @@
|
|||
|
||||
/* persist navigation scroll point */
|
||||
(function () {
|
||||
window.onunload = function () {
|
||||
var patternsNav = document.getElementById('patterns-nav')
|
||||
if (patternsNav) {
|
||||
var scrollPoint = patternsNav.scrollTop
|
||||
window.onunload = function () {
|
||||
localStorage.setItem('scrollPoint', scrollPoint)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
if (document.getElementById('patterns-nav')) {
|
||||
if (window.location.href.indexOf('patterns/') !== -1) {
|
||||
scrollPoint = parseInt(localStorage.getItem('scrollPoint'))
|
||||
document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
|
||||
} 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
|
@ -31,19 +31,21 @@
|
|||
|
||||
/* persist navigation scroll point */
|
||||
(function () {
|
||||
window.onunload = function () {
|
||||
var patternsNav = document.getElementById('patterns-nav')
|
||||
if (patternsNav) {
|
||||
var scrollPoint = patternsNav.scrollTop
|
||||
window.onunload = function () {
|
||||
localStorage.setItem('scrollPoint', scrollPoint)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
if (document.getElementById('patterns-nav')) {
|
||||
if (window.location.href.indexOf('patterns/') !== -1) {
|
||||
scrollPoint = parseInt(localStorage.getItem('scrollPoint'))
|
||||
document.getElementById('patterns-nav').scrollTop = parseInt(localStorage.getItem('scrollPoint'))
|
||||
} else {
|
||||
scrollPoint = 0
|
||||
document.getElementById('patterns-nav').scrollTop = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue
Block a user