Open Web page in modal box?

纵饮孤独 提交于 2019-12-08 03:57:59

问题


Is this possible? not just html but also a different stylesheet etc while blacking out the rest of the screen?

Thanks for any help.

Ann


回答1:


Check out Colorbox (Demo). It is a very well put together plugin for jQuery.

Using iFrames you are able to load pretty much anything into this modal plugin. Here is the example code for the demo w/ the iFrame.

markup

<a class='example7' href="http://google.com">Outside Webpage (Iframe)</a>

JavaScript

$(".example7").colorbox({iframe:true, innerWidth:425, innerHeight:344});

So, you could just change http://google.com to ./your-iFrame.html or whatever and it would load and render that entire page!




回答2:


You can either use window.showModalDialog(although this may be implemented as a new window) or implement a modal dialog yourself by loading the page in an <iframe> and adding a semi-transparent element whose z-index makes it cover the whole document.




回答3:


Yes, load the data into an iframe. Most modal scripts such as simple modal have this integrated very nicely and only a few options need to be adjusted to make use of it.



来源:https://stackoverflow.com/questions/6537102/open-web-page-in-modal-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!