Efek sliding sangat populer untuk membuat menu navigasi dropdown mobile dan komponen tanya-jawab (FAQ Accordion).
jQuery Slide
Contoh Kode jQuery jQuery Slide:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<style>
.accordion-header { background: #0d2e5c; color: white; padding: 12px; cursor: pointer; border-radius: 6px; }
.accordion-content { background: #f1f5f9; padding: 15px; display: none; border-radius: 0 0 6px 6px; }
</style>
</head>
<body style="font-family: sans-serif; padding: 20px;">
<div class="accordion-header">Klik untuk Menampilkan Jawaban Pertanyaan »</div>
<div class="accordion-content">Jawaban: jQuery memudahkan manipulasi DOM hanya dalam satu baris kode!</div>
<script>
$('.accordion-header').click(function() {
$('.accordion-content').slideToggle();
});
</script>
</body>
</html>
Uji interaksi jQuery di atas dan amati animasi efek DOM secara langsung.