[英]To Disable the background window when pop up opens
I have a link on my page. 我的页面上有一个链接。 When i click on it a pop up opens and the background becomes grey in color.
当我单击它时,会弹出一个弹出窗口,并且背景变成灰色。 But my problem is i am still able to click on other links present in background.
但是我的问题是我仍然可以单击背景中存在的其他链接。 The div id for background is pagewrapper.
背景的div ID是pagewrapper。 As far as i think code - document.getElementById('pagewrapper').disabled=true;
据我认为代码-document.getElementById('pagewrapper')。disabled = true; should have done the trick and diabled the entire background behind the pop up freezes.
应该已经完成了技巧,并且使弹出窗口冻结后的整个背景失效。 But it is not happening.
但这没有发生。
This is the code to open the popUp. 这是打开弹出窗口的代码。 Last line was supposed to disable the background window.
最后一行应该禁用背景窗口。
function popUpText(popUpContents)
{
// move the popup to a relative position to how the page is scrolled
var containerTop = Position.page($('pagewrapper'))[1];
$('popup').setStyle({top: ((0-containerTop)+100) + 'px'});
var popupPageHTML = $(popUpContents).innerHTML;
var uniquePopupPageHTML = popupPageHTML.replace(/-POPUP_ID_REPLACER-/g,"-");
$('popup').innerHTML = uniquePopupPageHTML;
toggleIt('popup');
$('pagewrapper').setOpacity(.3);
document.getElementById('pagewrapper').disabled=true;
}
You should create a popup layout which must cover entire body and z-index of the overlay should be between body and popup. 您应该创建一个弹出式布局,该布局必须覆盖整个主体,并且覆盖图的z索引应位于主体和弹出式窗口之间。 Delete the overlay when user closes the popup.
当用户关闭弹出窗口时,删除叠加层。
Edit: Here is a tutorial that you may follow: 编辑:这是您可能会遵循的教程:
http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/ http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.