开发者

Use jQuery SimpleModal to open an HTML file as a modal window

开发者 https://www.devze.com 2023-02-10 14:03 出处:网络
How can I use jQuery SimpleModal to open an html file as a modal window? Assume, On a TTM_1.html file I have a anchor and when I click on it show TTMD.html in a mod开发者_运维技巧al window.

How can I use jQuery SimpleModal to open an html file as a modal window? Assume, On a TTM_1.html file I have a anchor and when I click on it show TTMD.html in a mod开发者_运维技巧al window.

Thanks.


Here's a couple of different ways:

Load the data:

$(YOUR_ANCHOR).click(function (e) {
    e.preventDefault();

    // load the html file using ajax
    $.get("TTMD.html", function(resp){
        var data = $('<div></div>').append(resp);
        data.modal();
    });
});

Use an iframe:

$(YOUR_ANCHOR).click(function (e) {
    e.preventDefault();

    // change height, width and modal options as required
    $.modal('<iframe src=""TTMD.html" height="450" width="830" style="border:0">', {
        closeHTML:"",
        containerCss:{
            backgroundColor:"#fff",
            borderColor:"#fff",
            height:450,
            padding:0,
            width:830
        },
        overlayClose:true
    });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消