JavaScript的动画不HTML页面上工作

问题描述 投票:0回答:1

有在我的剧本的几个动画,但他们没有工作。我不能确定问题所在。什么可能阻止这些动画运行?

我已经在自己的网页上尝试每个动画,他们工作得很好。

jQuery(document).ready(function($){
  var $timeline_block = $('.cd-timeline-block');

  //hide timeline blocks which are outside the viewport
  $timeline_block.each(function(){
    if($(this).offset().top > $(window).scrollTop()+$(window).height()*0.75) {
      $(this).find('.cd-timeline-img, .cd-timeline-content').addClass('is-hidden');
    }
  });

  //on scolling, show/animate timeline blocks when enter the viewport
  $(window).on('scroll', function(){
    $timeline_block.each(function(){
      if( $(this).offset().top <= $(window).scrollTop()+$(window).height()*0.75 && $(this).find('.cd-timeline-img').hasClass('is-hidden') ) {
        $(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in');
      }
    });
  });
});

动画没有工作,一旦纳入到我的网站。

javascript jquery
1个回答
0
投票

看到你的回购。在线路542的index.html添加类cssanimations

    <section id="cd-timeline" class="cd-container cssanimations">

顺便说一句,你用body标签内body标签。切切实实这是不对的。

© www.soinside.com 2019 - 2024. All rights reserved.