Animate the hiding and showing of two divs, delaying the first before showing it using jquery

  • جي كويري

Animate the hiding and showing of two divs, delaying the first before showing it. using jquery

الأجوبة

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Animate the hiding and showing of two divs, delaying the first before showing it.</title>
</head>
<body>
<p><button>Run</button></p>
<div class="div1"></div>
<div class="div2"></div>
</body>
</html>

CSS Code :

 div {
 position: absolute;
 width: 50px;
 height: 50px;
 float: left;
 }
 .div1 {
 background-color: red;
 left: 0;
 }
 .div2 {
 background-color: green;
 left: 80px;
 }
 

JavaScript Code :

$( "button" ).click(function() {
$( "div.div1" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );
$( "div.div2" ).slideUp( 400 ).fadeIn( 300 );
});
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...