<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>jQuery Click</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> <!-- $(function() { $("div").click(function() { $("div").text("クリックされました"); }); }); // --> </script> </head> <body> <h1>jQuery DIV Click</h1> <div>ここをクリックして下さい</div> </body> </html> |
<html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>jQuery Click</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(function() { $("div").click(function() { $("div").hide(); }); }); </script> </head> <body> <h1>jQuery hide</h1> <div>クリックすると表示が消えます</div> </body> </html> |
jQuery("div").hide(); |
jQuery("div").fadeToggle(); |
jQuery("div").fadeToggle(3000); |
<html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>jQuery Click</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(function() { $("div").click(function() { this.style.backgroundColor = "yellow"; }); }); </script> </head> <body> <h1>jQuery Color</h1> <div>[1] ここをクリック</div> <div>[2] ここをクリック</div> <div>[3] ここをクリック</div> </body> </html> |
jQuery.each( { slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); |