Welcome to findnerd, today we are going to discuss on prepend() method in jQuery.
Firstlt let know what use of prepend() method
So, basically animate() method is used to creating custom animations.
Syntex of animate() method
$(selector).animate({params});
There are tow optional parametr in animate() method
1-speed:-It can take values: "slow", "fast", or milliseconds.
2-callback:-to be executed after the animation completes.
You can take reference of bellow example:
<!DOCTYPE html>
<html>
<head>
<!-- here call the jquery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").animate({left: '150px'});//here call animate() and pass parameter
});
});
</script>
</head>
<body>
<button>Animation Button</button>
<!--define a div class on which you can apply animate() -->
<p><div style="background:#000;height:50px;width:150px;position:absolute; color:#fff">Hi This is animate </div></p>
</body>
</html>
0 Comment(s)