jQuery simplemodal关闭现有模式并打开一个新模式吗? [英] Jquery simplemodal close existing modal and open a new one?
问题描述
好的,因此所有模式都已经在右上角有一个图像来关闭它们.我怎样才能另外做一个锚来做同样的事情?我以为我可以使用默认为"simplemodal-close"的"closeClass"选项,并将该类添加到锚点,但是没有达到预期的效果.那是我应该做的吗?另外,所有模态都将具有联系我们"链接,该链接应关闭其自身的模态并打开联系模态.我怎样才能等到它关闭才能打开下一个?
想法?
$('a#ask').click(function(){
$.modal.close(function(){
});
$('#modal-contact').modal();
});
1)如果将simplemodal-close
分配给对话框内容中的元素,SimpleModal将自动将close函数绑定到该元素的click事件. /p>
2)有多种方法可以执行此操作,方法是换出内容,或者先使用$ .modal.close()关闭对话框;否则,请执行以下操作.然后打开一个新的.
更新
$('a#ask').click(function(){
$('#modal-contact').modal({onShow: function (dialog) {
// handle the close yourself.
// Don't use the closeClass on this element
// call $.modal.close(); when you are done
// call a function to open a new modal
});
return false;
});
Alright, so all modals already have an image at the top right to close them. How can I make additionally another anchor to do the same thing? I thought I could use the "closeClass" option which default to "simplemodal-close" and just add that class to an anchor, but it didn't have the desired effect. Is that what I'm supposed to do? Also, all modals will have a "contact us" link which should close it's own modal and open the contact modal. How can I wait until it is closed to open the next one?
Ideas?
$('a#ask').click(function(){
$.modal.close(function(){
});
$('#modal-contact').modal();
});
1) If you assign simplemodal-close
to an element that is in the dialog content, SimpleModal will automatically bind the close function to click event for that element.
2) There are a number of ways you could do this, either by swapping out the content or first closing the dialog with $.modal.close(); then opening a new one.
UPDATE
$('a#ask').click(function(){
$('#modal-contact').modal({onShow: function (dialog) {
// handle the close yourself.
// Don't use the closeClass on this element
// call $.modal.close(); when you are done
// call a function to open a new modal
});
return false;
});
这篇关于jQuery simplemodal关闭现有模式并打开一个新模式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!