jQuery mempermudah penambahan efek transisi visual animasi pada elemen HTML tanpa memerlukan kode CSS keyframe yang rumit.
jQuery Effects
Soundboard Uji Efek Transisi jQuery:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<style>
body { font-family: sans-serif; padding: 20px; background: #f8fafc; }
.stage { background: white; padding: 25px; border: 1px solid #cbd5e1; border-radius: 8px; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.box { width: 100px; height: 100px; background: #fca311; border-radius: 8px; }
button { background: #0d2e5c; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; margin: 4px; }
</style>
</head>
<body>
<h3>Uji Efek Transisi Visual</h3>
<div class="stage">
<div class="box" id="kotakUji"></div>
</div>
<div style="margin-top: 15px;">
<button id="btnFadeToggle">fadeToggle()</button>
<button id="btnSlideToggle">slideToggle()</button>
<button id="btnZoomAnim">animate (Zoom)</button>
<button id="btnReset" style="background:#64748b;">Reset</button>
</div>
<script>
$(document).ready(function() {
$('#btnFadeToggle').click(function() { $('#kotakUji').fadeToggle(); });
$('#btnSlideToggle').click(function() { $('#kotakUji').slideToggle(); });
$('#btnZoomAnim').click(function() {
$('#kotakUji').animate({ width: '160px', height: '160px', opacity: 0.5 }, 400);
});
$('#btnReset').click(function() {
$('#kotakUji').stop().css({ width: '100px', height: '100px', opacity: 1, display: 'block' });
});
});
</script>
</body>
</html>
Klik tombol untuk mencoba variasi efek transisi pada kotak pengujian.