$(document).ready(function () {
$("#button").toggle(function () {
$("#preview").animate({
height: 940,
width: 940
}, 800);
$("#button").replaceWith('<div id="button" style="margin:50px">Close</div>');
}, function () {
$("#preview").animate({
height: 500,
width: 500
}, 800);
$("#button").replaceWith('<div id="button" style="margin:0px">Open</div>');
});
});
这会使预览屏幕更改大小并更改按钮,但它不会执行切换的第二部分,这将重新调整预览大小并将按钮的值更改为原始状态(打开)。
知道如何解决这个问题吗?