jQuery popup(bPopup)无法加载iFrame

时间:2014-07-29 13:21:45

标签: javascript php jquery html iframe

我创建了一个使用jQuery插件加载.php网站的弹出窗口:bpopup

问题是插件无法加载用php编码的网站。有人能告诉我哪里有问题吗?

这是我正在使用的代码:

JavaScript的:

$('#leader').bind('click', function (e) {
    // Prevents the default action to be triggered. 
    e.preventDefault();
    // Triggering bPopup when click event is fired
    $('#leaderboard').bPopup({
        modalClose: false,
        opacity: '0',
        positionStyle: 'fixed', //'fixed' or 'absolute'
        content: 'iframe', //'ajax', 'iframe' or 'image'
        contentContainer: '.content',
        loadUrl: 'http://remake.hr/memtest/leaderboard.php' //Uses jQuery.load()
    });
});

HTML:

<div id="leaderboard" class="info"></div>
<div class="button" id="leader"></div>

CSS:

.info {
    display:none;
    width:700px;
    background: rgb(38, 170, 225);
    /* Fall-back for browsers that don't support rgba */
    background: rgba(38, 170, 225, .9);
    color:white;
    line-height: 35px;
    padding: 25px 50px 50px 25px;
}

1 个答案:

答案 0 :(得分:2)

使用class="content"

为您的HTML添加内部div标记

使用contentContainer: '.content',指定此容器。

结果HTML:

<div id="leaderboard" class="info"><div class="content"></div></div>
<div class="button" id="leader"></div>