Toggle between fading in and fading out different boxes using jquery
HTML Code :
<!DOCTYPE html> <html> <head> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <meta charset="utf-8"> <title>Toggle between fading in and fading out different boxes</title> </head> <body> <p>fadeToggle() with different speed parameters.</p> <button>Click to fade in/out boxes</button><br><br> <div id="div1" style="width:100px;height:100px;background-color:#6D5050;"></div> <br> <div id="div2" style="width:100px;height:100px;background-color:#42D5A9;"></div> <br> <div id="div3" style="width:100px;height:100px;background-color:#8942D5;"></div> </body> </html>
JavaScript Code :
$("button").click(function(){ $("#div1").fadeToggle(); $("#div2").fadeToggle("slow"); $("#div3").fadeToggle(4000); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
HTML Code :
JavaScript Code :