1$( "#clickme" ).click(function() {
2 $( "#book" ).animate({
3 opacity: 0.25,
4 left: "+=50",
5 height: "toggle"
6 }, 5000, function() {
7 // Animation complete.
8 });
9});
10
1<!DOCTYPE html>
2<html>
3<head>
4<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
5<script>
6$(document).ready(function(){
7 $("button").click(function(){
8 $("div").animate({left: '250px'});
9 });
10});
11</script>
12</head>
13<body>
14
15<button>Start Animation</button>
16
17<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>
18
19<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>
20
21</body>
22</html>