Skip to content

Commit

Permalink
🐛 动画元素不能嵌套在父级以下的容器内,移除class找不到的报错
Browse files Browse the repository at this point in the history
  • Loading branch information
codetodamoon committed Jan 20, 2018
1 parent bd1a909 commit d309628
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
var aminate = binding.value
el.style.opacity = '0'
vm.$on('toogle_animate', function (curIndex) {
var curPage = +el.parentNode.getAttribute('data-id')
var parent = el.parentNode
while(parent.getAttribute('data-id') === null) {
parent = parent.parentNode
}
var curPage = +parent.getAttribute('data-id')
if (curIndex === curPage) {
that.addAnimated(el, aminate)
} else {
Expand All @@ -66,7 +70,8 @@
}

fullpage.removeAnimated = function (el, animate) {
if (el.getAttribute('class').indexOf('animated') > -1) {
ar classes = el.getAttribute('class')
if (classes && classes.indexOf('animated') > -1) {
el.classList.remove(animate.value)
}
}
Expand Down

0 comments on commit d309628

Please sign in to comment.