有来自 jQuery 示例https://jqueryui.com/dialog/#animated的代码。我想了解如何正确调用Dialog
按钮所属的那个。
$( function() {
$( ".dialog" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1
},
hide: {
effect: "blind",
duration: 1
}
});
$( ".opener" ).on( "click", function() {
$( ".dialog" ).dialog( "open" );
});
} );
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Animation</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<div class="dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button class="opener">Open Dialog</button>
<div class="dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button class="opener">Open Dialog</button>
</body>
</html>
1 个回答