jquery - 如何使用 jQuery 添加动画弹跳?

标签 jquery html animation

我觉得我有正确的代码来让它工作,但它什么也没做。我错过了什么吗?

$(document).ready(function() {
$("h2").addClass("animated bounce");
});

这也是我的 HTML。

<head>
<title>Brandon Stranc | Front End Developer</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <!-- to scale well with mobile -->

<link rel="stylesheet" type="text/css" href="_css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">

<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<!-- <script src="_js/script.js"></script> -->
</head>

<header id="header">
    <div class="overlay">
    <nav>

        <a href="#projects" class="slide-section" title="">Projects</a>

        <a href="#about-me" class="slide-section" title="">About Me</a>

        <a href="#contact" class="slide-section" title="">Contact</a>
    </nav>

    <h2>Front End Developer</h2>
    <h4>Making Websites for BB &hearts;</h4>
    </div>
</header>

最佳答案

add animate.css in page

$(document).ready(function() {
$("h2").addClass("animated bounce");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css" rel="stylesheet"/>
<header id="header">
    <div class="overlay">
    <nav>

        <a href="#projects" class="slide-section" title="">Projects</a>

        <a href="#about-me" class="slide-section" title="">About Me</a>

        <a href="#contact" class="slide-section" title="">Contact</a>
    </nav>

    <h2 >Front End Developer</h2>
    <h4>Making Websites for BB &hearts;</h4>
    </div>
</header>

关于jquery - 如何使用 jQuery 添加动画弹跳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46087953/

相关文章:

javascript - 将对象传递给事件 jQuery

html - 即使调整窗口大小时如何使 div 以关键帧动画为中心

swift - 从 PasteBoard 将 GIF 插入 UITextView 并为其设置动画

jquery - bootstrap 4 chrome 动画滞后 Accordion

javascript - 使用 jQuery 或 Javascript 在页面上选择数字

javascript - 为什么在我使用 getElementById Removed Script for other ID 时附加主体 div 被删除

javascript - 启用/禁用输入元素的脚本?

javascript - Google map API 中心标记 + 地理定位

javascript - 创建具有固定宽度和灵活高度的div

java - Android TextView 中的动画背景颜色