zoukankan      html  css  js  c++  java
  • jquery弹出框

    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.             //动画速度  
    12.             var speed = 500;  
    13.   
    14.             //绑定事件处理  
    15.             $("#btnShow").click(function(event)  
    16.             {  
    17.                 //取消事件冒泡  
    18.                 event.stopPropagation();  
    19.                 //设置弹出层位置  
    20.                 var offset = $(event.target).offset();  
    21.                 $("#divPop").css({ top: offset.top + $(event.target).height() + "px", left: offset.left });  
    22.                 //动画显示  
    23.                 $("#divPop").show(speed);  
    24.   
    25.             });  
    26.             //单击空白区域隐藏弹出层  
    27.             $(document).click(function(event) { $("#divPop").hide(speed) });  
    28.             //单击弹出层则自身隐藏  
    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">显示提示文字</button>  
    38.     </div>  
    39.           
    40.     <!-- 弹出层 -->  
    41.     <div id="divPop" style="background-color: #f0f0f0; border: solid 1px #000000; position: absolute; display:none;  
    42.          300px; height: 100px;">  
    43.         <div style="text-align: center;" >弹出层</div>  
    44.     </div>  
    45. </body>  
    46. </html>  
  • 相关阅读:
    git提交代码到github步骤
    HTML前端标签
    16-类视图
    15-auth系统与类视图
    14-中间件和上下文处理器
    13-会话技术及表单(cookies和session)
    07-Python Django view 两种return 方法
    10-请求与响应和HTML中的from表单
    09-表关联对象及多表查询
    08-常用查询及表关系的实现
  • 原文地址:https://www.cnblogs.com/loveAline/p/9005192.html
Copyright © 2011-2022 走看看