hola, gracias por la respuesta aca esta el codigo entero.
Código HTML:
/***************************/
/*@Author Adrian "yEnS" Mato Gondelle*/
/*@website www.yensdesign.com*/
/*@email [email protected]*/
/*@license Feel free to use it, but keep this credits please! */
/***************************/
/*SETTING UP OUR POPUP*/
/*0 means disabled - 1 means enabled */
var popupStatus = 0;
var popupStatusBilde = 0;
//loading popup with jQuery magic!
function loadPopup() {
//loads popup only if it is disabled
if (popupStatus == 0) {
$("#backgroundPopupSearch").css({
"opacity": "0.7"
});
$("#backgroundPopupSearch").fadeIn("slow");
$("#popupContactSearch").fadeIn("slow");
popupStatus = 1;
}
}
//loading popup with jQuery magic!
function loadPopupBilde() { //
//loads popup only if it is disabled
if(popupStatusBilde==0){
$("#backgroundPopupBilde").css({
"opacity": "0.7"
});
$("#backgroundPopupBilde").fadeIn("slow");
$("#slidebildeDiv").fadeIn("slow");
popupStatusBilde = 1;
}
}
//disabling popup with jQuery magic!
function disablePopup() {
//disables popup only if it is enabled
if (popupStatus == 1) {
$("#backgroundPopupSearch").fadeOut("slow");
$("#popupContactSearch").fadeOut("slow");
popupStatus = 0;
}
}
//disabling popup with jQuery magic!
function disablePopupBilde(){
//disables popup only if it is enabled
if(popupStatusBilde==1){
$("#backgroundPopupBilde").fadeOut("slow");
$("#slidebildeDiv").fadeOut("slow");
popupStatusBilde = 0;
}
}
//centering popup
function centerPopup() {
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popupContactSearch").height();
var popupWidth = $("#popupContactSearch").width();
//centering
$("#popupContactSearch").css({
"position": "absolute",
"top": windowHeight / 2 - popupHeight / 2,
"left": windowWidth / 2 - popupWidth / 2
});
//only need force for IE6
$("#backgroundPopupSearch").css({
"height": windowHeight
});
}
//centering popup
function centerPopupBilde(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#slidebildeDiv").height();
var popupWidth = $("#slidebildeDiv").width();
//centering
$("#slidebildeDiv").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6
$("#backgroundPopupBilde").css({
"height": windowHeight
});
}
//CONTROLLING EVENTS IN jQuery
$(document).ready(function() {
//LOADING POPUP
//Click the button event!
$("#button").click(function() {
//centering with css
centerPopup();
//load popup
loadPopup();
});
$("#slidebilde").click(function() {
//centering with css
centerPopupBilde();
//load popup
loadPopupBilde();
});
//CLOSING POPUP
//Click the x event!
$("#popupContactCloseSearch").click(function() {
disablePopup();
});
//Click out event!
$("#backgroundPopupSearch").click(function() {
disablePopup();
});
//Click the x event!
$("#bildeDivClose").click(function() {
disablePopupBilde();
});
$("#tilbake").click(function() {
disablePopupBilde();
});
//Click out event!
$("#backgroundPopupBilde").click(function() {
disablePopupBilde();
});
//Press Escape event!
$(document).keypress(function(e) {
if (e.keyCode == 27 && popupStatusS == 1) {
disablePopup();
}
});
$(document).keypress(function(e) {
if (e.keyCode == 27 && popupStatusBilde == 1) {
disablePopupBilde();
}
});
});