Run
Reset
Chrome
Cobalt
Monokai
Dreamweaver
Vibrant Ink
<!DOCTYPE html> <html> <head> <title>Learning jQuery</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> </head> <body> <button class="toggle-btn">Toggle</button> <div class="obj"></div> </body> </html>
.obj{ height: 100px; width: 500px; background-color: red; }
$(document).ready(function(){ // Kill and toggle // the current sliding // animation $(".toggle-btn").on("click", function(){ $(".obj").stop().slideToggle(1000); }); });