简体   繁体   English

我想使用 intercooler.js 将内容加载到 bootstrap 4 模态中

[英]I want to load content into a bootstrap 4 modal using intercooler.js

I'm trying to load content into a modal using intercooler, example here:我正在尝试使用中冷器将内容加载到模态中,例如:

http://jsfiddle.net/qvpy3coL/3/ http://jsfiddle.net/qvpy3coL/3/

I'm having no joy and wonder if this is possible, or whether the bootstrap js will conflict?我不高兴,想知道这是否可能,或者引导 js 是否会发生冲突?

Html is: Html 是:

<div id="confirm-me" class="btn btn-primary" data-toggle="modal" 
    data-target="#msgmodal" ic-get-from="/click" ic-target="dynamiccontent"
    ic-trigger="click">
    Click Me to show dynamic modal</div>

<div class="modal fade" id="msgmodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                 <h4 class="modal-title">
                 Below will be dynamic content</h4>
            </div>

            <div id="dynamiccontent">
            </div>
        </div>
    </div>
</div>

js is: js是:

// mockjax stuff ...
$.mockjax({
    url: "/click",
    responseTime: 500,
    response: function (settings) {
        this.responseText = "Dynamic stuff here!";
    }
});

I've never used intercooler but after a quick read it turns out there should be no problem.我从未使用过中冷器,但经过快速阅读后发现应该没有问题。

The only requirement with dynamic content you want in the modal is that it should be valid HTML code.您想要在模态中使用动态内容的唯一要求是它应该是有效的 HTML 代码。

I played with the example you put in some content:我使用了您放入一些内容的示例:

$('#dynamiccontent').html('No, it wont have any problems as long as your placing HTML')

https://jsfiddle.net/5pe6yz0w/3/ https://jsfiddle.net/5pe6yz0w/3/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM