|
@@ -26,12 +26,16 @@ var page = new Vue({
|
|
|
var scrollEle = document.querySelector('#main-app ')
|
|
|
var scrollTop = scrollEle.scrollTop
|
|
|
var animateEle = document.querySelectorAll('.fadeOut')
|
|
|
+ var windowHeight = window.innerHeight ||
|
|
|
+ document.documentElement.clientHeight ||
|
|
|
+ document.body.clientHeight;
|
|
|
animateEle[0].classList.add('fadeIn')
|
|
|
animateEle[1].classList.add('fadeIn')
|
|
|
animateEle.forEach(function (item) {
|
|
|
var itemTop = item.offsetTop
|
|
|
- var itemHeight = item.offsetHeight
|
|
|
- if (scrollTop >= itemTop - itemHeight / 2) {
|
|
|
+ // var itemHeight = item.offsetHeight
|
|
|
+ var flag = itemTop < scrollTop + windowHeight
|
|
|
+ if (scrollTop && flag) {
|
|
|
item.classList.add('fadeIn')
|
|
|
}
|
|
|
})
|