Jump to content

Popups


cmb

Recommended Posts

I followed this tutorial on how to do this and it all works except for when i went and tried to run the site in IE8 the popup comes up in the top left and idk how to fix it

#predata{
display:none;
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
height:auto;
width:auto;
background:#FFFFFF;
border:2px solid #cecece;
z-index:2;
padding:12px;
font-size:13px;
} 
#predata h1{
text-align:center;  
color:#6FA5FD;  
font-size:22px;  
font-weight:700;  
border-bottom:1px dotted #D3D3D3;  
padding-bottom:2px;  
margin-bottom:20px;  
}
#predataClose{
font-size:20px;  
line-height:20px;  
right:6px;  
top:4px;  
position:absolute;  
color:#6fa5fd;  
font-weight:700;  
display:block;  
}

///////////////////////////////Pre Data////////////////////////////////////////////////

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup3(){
//loads popup only if it is disabled
if(popupStatus==0){
	$("#backgroundPopup").css({
		"opacity": "0.7"
	});
	$("#backgroundPopup").fadeIn("slow");
	$("#predata").fadeIn("slow");
	popupStatus = 1;
}
}

//disabling popup with jQuery magic!
function disablePopup3(){
//disables popup only if it is enabled
if(popupStatus==1){
	$("#backgroundPopup").fadeOut("slow");
	$("#predata").fadeOut("slow");
	popupStatus = 0;
}
}

//centering popup
function centerPopup3(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#predata").height();
var popupWidth = $("#predata").width();
//centering
$("#predata").css({
	"position": "absolute",
	"top": windowHeight/2-popupHeight/2,
	"left": windowWidth/2-popupWidth/2
});
//only need force for IE6

$("#backgroundPopup").css({
	"height": windowHeight
});

}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){

//LOADING POPUP
//Click the button event!
$("#btn_predata").click(function(){
	//centering with css
	centerPopup3();
	//load popup
	loadPopup3();
});

//CLOSING POPUP
//Click the x event!
$("#predataClose").click(function(){
	disablePopup3();
});

});


Link to comment
https://forums.phpfreaks.com/topic/244506-popups/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.