Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Enhanced Pulse and Move Animation</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <!-- jQuery UI for color animation --> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> <style> body { font-family: Arial, sans-serif; background: #f0f3f6; padding: 50px; display: flex; flex-direction: column; align-items: center; } h2 { color: #2c3e50; margin-bottom: 10px; } p.description { color: #555; max-width: 550px; text-align: center; margin-bottom: 30px; font-size: 15px; } #pulseBox { position: relative; width: 100px; height: 100px; background-color: #e67e22; border: 4px solid #d35400; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.25); color: white; font-size: 16px; text-align: center; line-height: 100px; transition: background-color 0.3s ease; } #pulseBox:hover { background-color: #f39c12; } #startBtn { margin-top: 30px; padding: 10px 20px; font-size: 16px; background-color: #2c3e50; color: white; border: none; border-radius: 5px; cursor: pointer; } #startBtn:hover { background-color: #3e5871; } </style> </head> <body> <h2>jQuery Animate with Relative Tweens</h2> <p class="description"> This example demonstrates a clear pulse, color change, and diagonal movement using chained <code>.animate()</code> calls with relative values. </p> <div id="pulseBox">Animate Me</div> <button id="startBtn">Start Animation</button> <script> $(document).ready(function(){ $('#startBtn').click(function(){ var $box = $('#pulseBox'); $box .animate({width: '+=50px', height: '+=50px'}, {duration:400, easing:'swing'}) .animate({backgroundColor:'#27ae60'}, 300) .animate({width: '-=50px', height: '-=50px'}, 400) .animate({backgroundColor:'#e67e22'}, 300) .animate({left: '+=80px', top: '+=80px'}, 500) .animate({left: '-=80px', top: '-=80px'}, 500) .animate({left: '-=80px', top: '+=80px'}, 500) .animate({left: '+=80px', top: '-=80px'}, 500); }); }); </script> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console