Modal在之前打开后不会加载内容

时间:2011-10-15 22:08:35

标签: jquery modal-dialog

这是一个奇怪的,但......

我们有这段代码:

jQuery(function($) {
    $('#basic-modal .basic').click(function(e) {
        $('#basic-modal-content').modal();

        return false;
    });
    $('#basic-modal-also .basic').click(function(e) {
        $('#basic-modal-also-content').modal();

        return false;
    });
});

启动两个模态窗口中的任何一个。

他们的代码是:

< !-- First Modal Window -->
<div id="basic-modal-content">
    <h3>Modal Window 2</h3>
    <p>any <strong>html</strong> content or images can go in here </p>
</div>

< !-- Second Modal Window -->
<div id="basic-modal-also-content">
    <h3>Modal Window 1</h3>
    <p>any <strong>html</strong> content or images can go in here </p>
</div>

我发现的是onclick我们启动模态,它显示了它的内容。我们关闭它,当我们再次打开它时,它的内容是空的..

是否有一些非常明显的东西,我们是否需要冲洗任何东西,或者我需要给你一些更多的代码?

我们使用Eric Martins的simplemodal脚本。 http://www.ericmmartin.com/projects/simplemodal/

好看,我们之间存在冲突,不确定是什么原因导致的。

我们有simplemodal和simplecountdown。 简单模态代码:http://www.ericmmartin.com/projects/simplemodal/ 简单倒计时代码:https://github.com/hilios/jquery.countdown/

不知道是否有人遇到过这场冲突。我也会在谷歌上问埃里克

1 个答案:

答案 0 :(得分:1)

很多时候模态会处理内容或以某种方式隐藏它。模态脚本通常不会考虑您可能再次打开它的事实。他们假设您只打开它,在窗口中执行XYZ,然后继续前进。我在这种情况下所做的一件事是每次启动模式时都通过jQuery重新加载内容,如果实际上是这样的话。我会用这个:

    <div id="modal">content will land here</div>
    $('#modal').html('<p>any html content or images can go in here </p>');

很难说这是否真的是你的问题,但这是我在模态对话框中遇到的很多事情。