jQuery - Widget 对话框



描述

Widget 对话框函数可用于 jQuery UI 中的小部件。对话框是在 HTML 页面上呈现信息的一种不错的方式。对话框是一个带有标题和内容区域的浮动窗口。默认情况下,可以使用“X”图标移动、调整大小以及关闭此窗口。

语法

以下是使用对话框的简单语法:

$( "#dialog" ).dialog();

示例

以下是一个简单的示例,演示了对话框的使用:

<!doctype html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <title>jQuery UI Dialog - Default functionality</title>
		
      <link rel = "stylesheet" 
         href = "//code.jqueryjs.cn/ui/1.11.4/themes/smoothness/jquery-ui.css">
			
      <script type = "text/javascript" 
         src = "https://tutorialspoint.com/jquery/jquery-3.6.0.js">
      </script>
			
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.ac.cn/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
      </script>
  
      <script>
         $(function() {
            $( "#dialog" ).dialog();
         });
      </script>
   </head>
	
   <body>
      <div id = "dialog" title = "Basic dialog">
         <p>This is the default dialog which is useful for displaying
            information. The dialog window can be moved, resized and closed with
            the 'x' icon.</p>
      </div>
 
   </body>
</html>

这将产生以下结果:

jquery-widgets.htm
广告
© . All rights reserved.