Showing posts with label make pop up with jquery. Show all posts
Showing posts with label make pop up with jquery. Show all posts

Tuesday, 10 January 2012

Open popup with jquery

/*function showModelPopup(containner, isDialog,hideOnOutsideClick,zIndex)
{
if (zIndex != undefined) {
_zindex = zIndex;
}
var windowHeight = jQuery(window).height();
var windowWidth = jQuery(window).width();
var newLeft = 0;
var newTop = 0;
var targetContainer = jQuery('.' + containner);
var numberOfModels = jQuery('.faliaModel').length;

targetContainer.addClass('_mdd' + containner);

var model = "
";
if (jQuery("._md" + containner).length == 0) {
jQuery('body').append(model);
}
if (isDialog == undefined) {
isDialog = 0;
}


if (isDialog == 0) {
jQuery("._md" + containner).fadeIn(500).height(
jQuery(document).height() + 'px');
}

jQuery("._md" + containner).css('z-index', ++_zindex);
targetContainer.css('z-index', ++_zindex);
var windowPositionTop = jQuery(window).scrollTop();

if (targetContainer.width() > windowWidth) {
targetContainer.css('width', windowWidth - 100);
newLeft = 50;
} else if (targetContainer.width() < windowWidth) { newLeft = (windowWidth - targetContainer.width()) / 2; } if (targetContainer.height() > windowHeight) {
targetContainer.css('height', windowHeight - 100);
newTop = 50;
} else if (targetContainer.height() < windowHeight) {
newTop = (windowHeight - targetContainer.height()) / 2;
}

targetContainer.css('left', newLeft);
targetContainer.css('top', windowPositionTop + newTop);
targetContainer.fadeIn(200);

targetContainer.find('.closePopup').click(function() {
hideModel();
});
jQuery('._md' + containner).click(function() {
if(hideOnOutsideClick== undefined)
hideModel();
});

function hideModel() {
jQuery('._md' + containner).fadeOut(500);
jQuery('.' + jQuery('._md' + containner).attr('rel')).fadeOut(500);
if (typeof closeOperation == 'function') {
closeOperation();
}
}
;
}

function hideModel(_container) {
jQuery('._md' + _container).fadeOut(500);
jQuery('.' + jQuery('._md' + _container).attr('rel')).fadeOut(250);
if (typeof closeOperation == 'function') {
closeOperation();
}*/