JavaScript Tutorial/jQuery/Event Double Click

Материал из Web эксперт
Перейти к: навигация, поиск

30. Bind double click event to header

   <source lang="javascript">

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
       $(document).ready(function(){
            $("h1").bind("dblclick", function(e){
                var str = "( " + e.pageX + ", " + e.pageY + " )";
                $("h1").text("Click happened! " + str);
            });


       });
   </script>
 </head>
 <body>
   <body>

header 1

   </body>

</html></source>


30. Double click to slide up

   <source lang="javascript">

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
       $(document).ready(function(){
             $("p").dblclick(function () { 
                  $(this).slideUp(); 
             });
       });
   </script>
 </head>
 <body>
   <body>

asdf

asdf

   </body>

</html></source>