'functionCallOnOpen' 似乎工作正常,但 'functionCallOnClose'(我真正想使用的那个)似乎不起作用。我也尝试过 .closeDOMWindow click() 但只有在单击关闭按钮时才会调用它——而不是在单击外部区域时(这也会关闭窗口)。这是插件的源代码: http ://swip.codylindley.com/jquery.DOMWindow.js
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://swip.codylindley.com/jquery.DOMWindow.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#test1').click(function(event) {
$.openDOMWindow({
functionCallOnOpen: function () {
alert("opening");
},
functionCallOnClose: function () {
alert("closing");
},
height:100,
width:200,
windowSourceID:'#theWindow'
});
});
});
</script>
<button id="test1">Open Window</button>
<div style="display:none;" id="theWindow">
<h1>Test</h1>
<button class="closeDOMWindow">Close</button>
</div>