简体   繁体   English

javascript弹出窗口,如iframe,div或窗口始终位于更改链接的顶部

[英]javascript popup window as iframe, div,or window always on top on changing links

in web page, is it possible to open 'popup' frame as: 在网页中,是否可以通过以下方式打开“弹出”框架:
div or iframe or even window, so : div或iframe甚至是窗口,因此:
1. the user can see both , the pop window and the 'main' page ? 1.用户可以同时看到弹出窗口和“主页”页面吗?

  1. on change link in specific domain, the popped frame will remain always on top 在特定域中的更改链接上,弹出的框架将始终保持在顶部
    ( with additional code if needed) (如果需要,还有其他代码)

  2. the user can see both the frame and the main a and get focus with mouse click on the popped and main 用户既可以看到框架,也可以看到主体a,并通过鼠标单击弹出的主体

  3. possibility to access objects/events from popped and main. 从弹出窗口和主窗口访问对象/事件的可能性。 (in iframe even on different origin) (甚至在不同来源的iframe中)

  4. in standard desktop application, we can achieve it, as MDI forms, for example. 在标准桌面应用程序中,我们可以以MDI形式实现它。

    code sample or link will help. 代码示例或链接会有所帮助。

Example: 例:

 $("#simple").dialog( { autoOpen: false, open: function() { $("#withIframe").dialog( "moveToTop" ); }, focus: function( event, ui ) { $("#withIframe").dialog( "moveToTop" ); } }); $("#withIframe").dialog( { autoOpen: false, open: function(ev, ui){ $('#if').attr('src','http://www.jQuery.com'); $(this).dialog( "moveToTop" ); } }); $(".link").click(function() { $("#simple").dialog('option','modal',$('#isModal').prop('checked')).dialog( "open" ); }); $(".link_iframe").click(function() { $("#withIframe").dialog( "open" ); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://code.jquery.com/ui/jquery-ui-git.css" rel="stylesheet"/> <script src="https://code.jquery.com/ui/jquery-ui-git.js"></script> <label><input type='checkbox' id='isModal' /> Is Modal? </label> <a href='#' class='link'>link</a> <a href='#' class='link_iframe'>link (iframe)</a> <div id='simple'> <h2> Simple dialog </h2> </div> <div id='withIframe'> <iframe id='if' src=''></iframe> </div> 

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

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