animation.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. export default {
  2. data () {
  3. return {
  4. animationLoaded: false
  5. }
  6. },
  7. methods: {
  8. scrollFun() {
  9. if (!(this.$route.meta.name == 'pages-News-news' || this.$route.meta.name == 'pages-Live-Live' || this.$route.meta.name == 'pages-Videos-index' || this.$route.meta.name == 'pages-game-index')) {
  10. return
  11. }
  12. let pointList = [...this.$('.fadeInRight'), ...this.$('.fadeInLeft'), ...this.$('.fadeInTop'), ...this.$('.fadeInBtm')]
  13. var scrollTop = this.$(window).scrollTop()
  14. var scrollHeight = (this.$(window).height() - 150)
  15. pointList.forEach((item, index) => {
  16. let ele = this.$(item)
  17. var height = ele.height()
  18. var top = (ele.offset().top) - scrollTop
  19. if (top > 0 && top < (scrollHeight)) {
  20. if (!(ele.hasClass('animation'))) {
  21. ele.addClass('animation')
  22. }
  23. }
  24. if (top < 0 && (height + top) > 0) {
  25. if (!(ele.hasClass('animation'))) {
  26. ele.addClass('animation')
  27. }
  28. }
  29. })
  30. }
  31. }
  32. }