如何打开一个新的模态窗口来关闭simplemode的当前使用
How to open a new modal window to close the current use of simplemodal
我在项目的eric下使用了一个简单的模态。这是一个非常好的js
http://www.ericmmartin.com/projects/simplemodal/
我关闭osx模式窗口作为osx模式中的一个按钮,同时想打开一个简单的模式窗口。但这并不容易。
如何打开基本模态关闭osx模态打开osx模态?
如果检查页面http://www.ericmmartin.com/projects/simplemodal/,
查找回调
有一个onClose
回调,当旧模式关闭时,您可以使用它来关闭和打开新模式,
创建以下示例
两种模式的HTML
//Modal One
<a href="#" class="demo button">Demo</a>
<div id="basic-modal-content">
<h3>Basic Modal Dialog</h3>
<p>For this demo, SimpleModal is using this "hidden" data for its content.
You can also populate the modal dialog with standard HTML or with DOM element(s).</p>
<p>
<button class="simplemodal-close">Close</button> <span>(or press ESC)</span>
</p>
</div>
//Modal Two
<div id="newmodal">
<h3>New Modal Dialog</h3>
<p>Hey I'm new modal and open when old one is closed, Hey I'm new modal and open when old one is closed,
Hey I'm new modal and open when old one is closed, Hey I'm new modal and open when old one is closed,
Hey I'm new modal and open when old one is closed, Hey I'm new modal and open when old one is closed</p>
</div>
JS代码
$(document).ready(function(){
$('.demo').click(function (e) { //Open First Modal with Click Function
e.preventDefault();
$('#basic-modal-content').modal({ //First Modal Show
onClose: function (dialog) { //On Close Function
dialog.data.fadeOut('slow', function () {
dialog.overlay.fadeOut('slow', function () {
$.modal.close(); // must call this to close old modal and clear all data!
$('#newmodal').modal(); //Open New Modal
});
});
}
});
});
});
工作Fiddle示例
相关文章:
- 创建一个类似链接的按钮,并通过Javascript函数打开一个新的弹出窗口
- 防止Iframe窗体在新窗口中打开
- 内部分区字体大小获胜'调整浏览器窗口大小时不会随媒体查询而更改
- 调整窗口大小时,可拖动的对象会出现在容器外部
- Javascript排序的图像弹出窗口..可以't单独弹出
- 窗口大小html css
- 弹出窗口出现,然后退出
- 为什么不是't窗口.恢复正常工作吗?(javascript/jquery)
- Javascript更新孙窗口中的表单元素
- 如何在选项卡上定义属性'的主窗口对象
- CSS-若窗口太小,滚动条会出现在“表格”单元格上
- 召回窗口加载事件 - javascript
- 为什么不显示警报窗口
- 如何使用modalDialog来显示可以在所有浏览器中工作的弹出窗口
- Chrome应用程序调整窗口大小保持纵横比
- 新选项卡被弹出窗口阻止程序阻止
- 如何访问UIWebView'的子窗口上下文
- 刷新父窗口后无法关闭窗口
- 自动关闭弹出窗口的Javascript
- 如何打开一个新的模态窗口来关闭simplemode的当前使用