JavaScript jQuery Basics Introducing jQuery jQuery Syntax and Animation Effects

Sorin Chircu
Sorin Chircu
38,289 Points

what's wrong with my code?

I can't really figure out what I am doing wrong

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<body>
    <h1 class="profile-header">Student <span>Profile</span></h1>

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
//document.querySelector('.profile-header').style.display = 'none';
$('.profile-header').hide();
$('.profile-header').delay(2000);
$('.profile-header').fadeIn();

1 Answer

Steven Parker
Steven Parker
204,004 Points

The jQuery animation functions are normally synchronous. To make them asynchronous (performed in order), you can chain them:

$('.profile-header').hide().delay(2000).fadeIn();