jquery ui 彈窗效果

來源:互聯網
上載者:User

標籤:

  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. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>類比dialog效果</title>  
  6. <!--引入jquery類庫-->  
  7. <script language="javascript" type="text/javascript" src="jquery-1.7.1.min.js"></script>  
  8. <script language="javascript" type="text/javascript" src="jquery-ui-1.8.18.custom.min.js"></script>  
  9. <!--引入Css樣式類庫檔案-->  
  10. <link rel="stylesheet" href="jquery-ui-1.8.18.custom.css" />  
  11. <script language="javascript" type="text/javascript">  
  12. $(function (){  
  13.       
  14.         $("#dialog").dialog({  
  15.                autoOpen:false,  //設定對話方塊開啟的方式 不是自動開啟  
  16.                show:"blind",    //開啟時的動畫效果  
  17.                hide:"explode",    //關閉是的動畫效果  
  18.                modal:true,          //true代表運用遮罩效果  
  19. /*             buttons:{        //添加按鈕的操作  
  20.                    "確定":function (){  
  21.                             $(this).dialog("close");//關閉對話方塊  
  22.                        },  
  23.                     "取消":function (){  
  24.                             $(this).dialog("close");  
  25.                         }  
  26.                      
  27.                    },  
  28.                    //上邊是第一種方式  
  29.                      
  30.                    //下邊是第二種方式  
  31.                    */  
  32.                 buttons:[  
  33.                     {  
  34.                         text:"Ok",  
  35.                         click:function (){  
  36.                             $(this).dialog("close");//關閉對話方塊  
  37.                         }  
  38.                     },  
  39.                         {  
  40.                         text:"取消",  
  41.                         click:function (){  
  42.                             $(this).dialog("close");//關閉對話方塊  
  43.                         }  
  44.                     }],  
  45.                 draggable:false,   //是否可以拖動的效果  true可以拖動  預設值是true    ,false代表不可以拖動  
  46.                 closeOnEscape:false,   //是否採用esc鍵退出對話方塊,如果為false則不採用 ,true則採用  
  47.                 title:"添加使用者操作",    //對話方塊的標題  
  48.                 position:"top",         //對話方塊開啟的位置,預設center,有top、left、right、center、bottom  
  49.                 width:600,      //設定對話方塊的寬度  
  50.                 height:300,     //設定對話方塊的高度  
  51.                 resizable:false,   //是否可以改變對話方塊的尺寸的操作,預設true           
  52.                 zIndex:1000,    //層疊效果  
  53.                 drag:function(event,ui){  
  54.                         //可以測試出 對話方塊當前的座標位置  
  55.                           
  56.                     }  
  57.             });  
  58.           
  59.         //觸發串連的事件   當你點擊 串連  開啟一個對話方塊  
  60.         $("#dialog_link").click(function (){  
  61.               
  62.             $("#dialog").dialog("open");  //open參數  作用  開啟對話方塊  
  63.             });  
  64.           
  65.         //我怎麼擷取 我設定的options中的參數值  
  66.         var modalValue = $("#dialog").dialog("option","modal");  
  67.         alert(modalValue);  
  68.           
  69.         //我怎麼設定options中的參數值  
  70.         $("#dialog").dialog("option","modal",false);  
  71.     });  
  72.   
  73.   
  74.   
  75. </script>  
  76. </head>  
  77.   
  78. <body>  
  79.     <h2>類比dialog效果</h2>  
  80.     <!--建立一個串連-->  
  81.     <a href="javascript:void(0)" id="dialog_link"><span></span>open dialog</a>  
  82.       
  83.     <!--註冊一個div  $("#dialog").dialog(); 它就成了一個對話方塊 在頁面中就會隱藏-->  
  84.     <div id="dialog" title="hi!">  
  85.             hello world!  
  86.     </div>  
  87. </body>  
  88. </html>  

jquery ui 彈窗效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.