我刚刚尝试将wow.js应用到我的网站,但它无法正常工作。 我已将所有内容联系起来,但我不知道它为什么不起作用。 我甚至添加了wow.js并将其链接到html,但似乎仍然没有任何效果。我还添加了animate.css,但仍然没有效果。
HTML
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="animate.css">
<script language="javascript" type="text/javascript"src="javascript.js"></script>
<script language="javascript" type="text/javascript" src="wow.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<title> Vids </title>
<a href="index.html"> <header> <img src="images/Logo.png" > </header></a>
</head>
<body>
<div class="vids-title">
<p>Vids</p>
</div>
<div class="video-1 wow slideInRight">
<h>Shia LaBeouf delivers the most intense motivational speech of all-time</h>
<iframe width="550" height="435"
src="https://www.youtube.com/embed/nuHfVn_cfHU">
</iframe>
</div>
<div class="video-2 wow slideInLeft">
<h>Truth or Drink (Exes)</h>
<iframe width="550" height="435"
src="https://www.youtube.com/embed/pxYpvNMbdXQ">
</iframe>
</div>
<div class="video-3 wow slideInRight">
<h>Walker broke his arm</h>
<iframe width="550" height="435"
src="https://www.youtube.com/embed/5-NXguyFFko">
</iframe>
</div>
的javascript
$(function(){
new WOW().init();
});
答案 0 :(得分:2)
您的代码没有任何问题 - 它的工作正常
https://jsfiddle.net/k3qaoyxe/
我将目录作为外部资源包含在内,然后
$(function(){
new WOW().init();
});
工作得很好。
您确定已正确包含所有库并且它们正确加载 - 请检查开发人员控制台中的网络选项卡 图书馆包括cdn:
https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.3.0/animate.css
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js
https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.js
答案 1 :(得分:1)
<script language="javascript" type="text/javascript"src="javascript.js"></script>
<script language="javascript" type="text/javascript" src="wow.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
应该是
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="wow.js"></script>
<script language="javascript" type="text/javascript"src="javascript.js"></script>
答案 2 :(得分:0)
对我来说,除了文档就绪事件外,在窗口加载事件中调用WOW后,它的工作效果很好:
//At the document ready event
$(function(){
new WOW().init();
});
//also at the window load event
$(window).on('load', function(){
new WOW().init();
});