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
});
});
精彩评论