Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Durations & Easing</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style>#a,#b{position:relative;width:50px;height:50px;margin:6px;background:#90caf9}</style> </head> <body> <button id="go">Run</button> <div id="a"></div> <div id="b"></div> <script> $("#go").on("click", function(){ $("#a").animate({left:200}, "slow", "swing"); $("#b").animate({left:200}, 200, "linear"); }); </script> </body> </html>
Output