b0y-101 Mini Shell


Current Path : E:/www2/plan/media/com_jevents/lib_jevmodal/js/
File Upload :
Current File : E:/www2/plan/media/com_jevents/lib_jevmodal/js/jevmodal.js

function jevModalPopup(id, url, title){
	addJevModalHtml(id);
	
	// see http://stackoverflow.com/questions/16152275/how-to-resize-twitter-bootstrap-modal-dynamically-based-on-the-content
	jQuery('#'+id+' .modal-header').css({  'display':'block'});
	jQuery('#'+id+' .modal-title').html(title)
	launchJevModal('#'+id,url);

	return;
}

function jevModalNoHeader(id, url){
	addJevModalHtml(id);

	// see http://stackoverflow.com/questions/16152275/how-to-resize-twitter-bootstrap-modal-dynamically-based-on-the-content
	jQuery('#'+id+' .modal-body').css({  'top':'5px'});
	jQuery('#'+id+' .modal-header').css({  'display':'none'});
	launchJevModal('#'+id,url);
	return;
}

function jevModalNoTitle(id, url){
	addJevModalHtml(id);

	// see http://stackoverflow.com/questions/16152275/how-to-resize-twitter-bootstrap-modal-dynamically-based-on-the-content
	jQuery('#'+id+' .modal-body').css({  'top':'5px'});
	jQuery('#'+id+' .modal-header .close').css({'margin-right': '-15px','margin-top':'-15px','opacity': 1,'font-size:':'30px'});
	jQuery('#'+id+' .modal-header ').css({'height': '0px','z-index':'99','border':'none'});
	jQuery('#'+id+' .modal-header .modal-title').css({  'display':'none'});

	launchJevModal('#'+id,url);
	return;
}

function launchJevModal(selector, url) {
	// Clear the old page!
	jQuery(selector+' iframe').attr("src","about:blank");
	/** Will be true if bootstrap 3 is loaded, false if bootstrap 2 or no bootstrap */
	var bootstrap3_enabled = (typeof jQuery().emulateTransitionEnd == 'function');
    if (bootstrap3_enabled){
        jQuery(selector).off('shown.bs.modal');
        jQuery(selector).on('shown.bs.modal', function () {
            //jQuery(selector+' iframe').attr("src","about:blank");
            // scrolling issue in iOS 11.3
            var scrollT = jQuery(window).scrollTop();
            if (scrollT > 0)
            {
                jQuery(selector).data('scrollTop', scrollT);
            }
            jQuery('body').css({
                position:'fixed'
            });
            if (url) {
                jQuery(selector + ' iframe').attr("src", url);
            }
        });
        jQuery(selector).on('hidden.bs.modal', function () {
            // scrolling issue in iOS 11.3
            jQuery('body').css({
                position:'static'
            });
            var scrollT = jQuery(selector).data('scrollTop') || 0;
            if (scrollT > 0)
            {
                jQuery(window).scrollTop(scrollT);
            }
        });
    }
    else {
        jQuery(selector).off('shown');
        jQuery(selector).on('shown', function () {
            //jQuery(selector+' iframe').attr("src","about:blank");
            // scrolling issue in iOS 11.3
            var scrollT = jQuery(window).scrollTop();

            if (scrollT > 0)
            {
                jQuery(selector).data('scrollTop', scrollT);
            }
            jQuery('body').css({
                position:'fixed'
            });
            if (url) {
                jQuery(selector + ' iframe').attr("src", url);
            }
        });
        jQuery(selector).on('hidden', function () {
            // scrolling issue in iOS 11.3
            jQuery('body').css({
                position:'static'

            });
            var scrollT = jQuery(selector).data('scrollTop') || 0;
            if (scrollT > 0)
            {
                jQuery(window).scrollTop(scrollT);
            }
        });
    }
	jQuery(selector)
		.modal({ backdrop: true, show:true, keyboard:true, remote:'' })   // initialized with no keyboard
		;
	return;
}

function addJevModalHtml (id){
	/** Will be true if bootstrap 3 is loaded, false if bootstrap 2 or no bootstrap */
	var bootstrap3_enabled = (typeof jQuery().emulateTransitionEnd == 'function');
	var myModal="";
	var modalsize='jevmodal-full';
	if (!jQuery("#"+id).length){
		if (bootstrap3_enabled){
			myModal = '<div class="modal   fade ' + modalsize + ' jevmodal" id="'+id+'" tabindex="-1" role="dialog" aria-labelledby="'+id+'Label" aria-hidden="true" >'
				+'<div class="modal-dialog modal-lg">'
					+'<div class="modal-content">'
						+'<div class="modal-header">'
							+'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'
							+'<h4 class="modal-title" id="'+id+'Label"></h4>'
						+'</div>'
						+'<div class="modal-body">'
							+'<iframe src="about:blank;"></iframe>'
						+'</div>'
					+'</div>'
				+'</div>'
			+'</div>';
		}
		else {
			myModal = '<div class="modal  hide fade ' + modalsize + ' jevmodal" id="'+id+'" tabindex="-1" role="dialog" aria-labelledby="'+id+'Label" aria-hidden="true" >'
				+'<div class="modal-dialog modal-lg">'
					+'<div class="modal-content">'
						+'<div class="modal-header">'
							+'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'
							+'<h4 class="modal-title" id="'+id+'Label"></h4>'
						+'</div>'
						+'<div class="modal-body">'
							+'<iframe src="about:blank;"></iframe>'
						+'</div>'
					+'</div>'
				+'</div>'
			+'</div>';
		}
		// see http://stackoverflow.com/questions/10636667/bootstrap-modal-appearing-under-background
		jQuery(myModal).appendTo("body");
	}
}


Copyright © 2019 by b0y-101