jquery popup

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4.     <title>jQuery - Start Animation</title>  
  5.   
  6.     <script type="text/javascript" src="../scripts/jquery-1.3.2-vsdoc2.js" ></script>  
  7.   
  8.     <script type="text/javascript">  
  9.         $(document).ready(function()  
  10.         {  
  11.             // animation speed  
  12.             var speed = 500;  
  13.   
  14.             //bind event handler  
  15.             $("#btnShow").click(function(event)  
  16.             {  
  17.                 // cancel event bubbling  
  18.                 event.stopPropagation();  
  19.                 //Set the popup layer position  
  20.                 var offset = $(event.target).offset();  
  21.                 $("#divPop").css({ top: offset.top + $(event.target).height() + "px", left: offset.left });  
  22.                 //animation display  
  23.                 $("#divPop").show(speed);  
  24.   
  25.             });  
  26.             //Click the blank area to hide the popup layer  
  27.             $(document).click(function(event) { $("#divPop").hide(speed) });  
  28.             //Click the popup layer to hide itself  
  29.             $("#divPop").click(function(event) { $("#divPop").hide(speed) });  
  30.         });  
  31.     </script>  
  32.   
  33. </head>  
  34. <body>  
  35.     <div>  
  36.         <br /><br /><br />  
  37.         < button  id= "btnShow" >Show prompt text </ button >  
  38.     </div>  
  39.           
  40.     <!-- Popup layer -->  
  41.     <div id="divPop" style="background-color: #f0f0f0; border: solid 1px #000000; position: absolute; display:none;  
  42.         width: 300px; height: 100px;">  
  43.         < div  style= "text-align: center;"  >Popup layer </ div >  
  44.     </div>  
  45. </body>  
  46. </html>  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325721661&siteId=291194637