照片墙开发记录

This commit is contained in:
结发受长生
2019-05-12 16:44:15 +08:00
parent 2e97817463
commit f02fc05b1e
4 changed files with 268 additions and 2 deletions
+3 -1
View File
@@ -30,10 +30,11 @@ function loadMoreItems(step) {
} else {
currentIndex = index
}
itemContainer.classList.add('item-container')
itemContainer.insertAdjacentHTML('beforeend', imgItems)
document.getElementById('photo-wall').appendChild(itemContainer)
loadTip.style.display = 'none'
setTimeout(()=>{
loadTip.style.display = 'none'
scrollLock = false
}, 2000)
}).catch(res => { // 未加载到文件列表, 代表已经没有更多图片
@@ -55,6 +56,7 @@ function init() {
var _onscroll = scrollDom.onscroll
var timer = null
scrollDom.onscroll = function () {
// 保留已有的滚动事件回调函数并在新的回调函数中进行调用
typeof _onscroll === 'function' && _onscroll.apply(this, arguments)
if(scrollLock) return
if(timer) clearTimeout(timer)