javascript - Javascript 动画在 HTML 页面上不起作用
问题描述
我的脚本中有几个动画,但它们不起作用。我无法确定问题所在。什么可能会阻止这些动画运行?
我已经在自己的 html 页面中尝试了每个动画,它们工作正常。
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');
}
});
});
});
动画一旦并入我的网站就不起作用。
解决方案
看到你的回购。在第 542 行的 index.html 中添加一个类cssanimations
<section id="cd-timeline" class="cd-container cssanimations">
顺便说一句,您在body
标签内使用了body
标签。萨利这是不对的。
推荐阅读
- python - gpsd & python:解释 SKY 数据
- schema - Graphql:如何在解析另一种类型时定义一个类型以使用特定实例?
- git - 如何在保留提交的同时将项目从我的个人仓库移动到组织仓库
- php - 如何在详细信息页面中创建动态操作表单 - PHP
- github - 当我在命令提示符下键入 git clone url 时,获取 'git' 不被识别为内部或外部命令
- sql - Oracle 查找并重写连续行
- r - 使用 R 绘制图形
- android - 如何在约束布局中获取视图坐标
- android - 在某些手机中启动屏幕后应用程序崩溃
- amazon-cloudformation - Cloudformation 模板中的 Fn::Split 和 Fn::Select 组合