SOLVED:
Add to the files um-functions.js and um-function.min.js the following code:
var $docEl = jQuery("body,html"),
$wrap = jQuery('#wrap'),
scrollTop;
function overlayClose() {
jQuery.unlockBody();
}
function overlayOpen() {
jQuery.lockBody();
}
jQuery.lockBody = function() {
if(window.pageYOffset) {
scrollTop = window.pageYOffset;
$wrap.css({
top: - (scrollTop)
});
}
$docEl.css({
height: "100%",
overflow: "hidden"
});
}
jQuery.unlockBody = function() {
$docEl.css({
height: "",
overflow: ""
});
$wrap.css({
top: ''
});
window.scrollTo(0, scrollTop);
window.setTimeout(function () {
scrollTop = null;
}, 0);
}
And add overlayClose() and overlayOpen() to the following functions:
function remove_Modal() {
if ( jQuery('.um-popup-overlay').length ) {
wp.hooks.doAction( 'um_before_modal_removed', jQuery('.um-popup') );
jQuery('.tipsy').remove();
jQuery('.um-popup').empty().remove();
jQuery('.um-popup-overlay').empty().remove();
overlayClose();
}
}
function um_remove_modal() {
jQuery('img.cropper-hidden').cropper('destroy');
overlayClose();
jQuery(document).unbind('touchmove');
jQuery('body > .um-modal div[id^="um_"]').hide().appendTo('body');
jQuery('body > .um-modal, body > .um-modal-overlay').remove();
}
function um_new_modal( id, size, isPhoto, source ) {
var modalOverlay = jQuery('.um-modal-overlay');
if ( modalOverlay.length !== 0 ) {
modalOverlay.hide();
modalOverlay.next('.um-modal').hide();
}
jQuery('.tipsy').hide();
UM.dropdown.hideAll();
overlayOpen();
jQuery( document ).bind( "touchmove", function(e){e.preventDefault();});
jQuery( '.um-modal' ).on('touchmove', function(e){e.stopPropagation();});
var $tpl = jQuery( '<div class="um-modal-overlay"></div><div class="um-modal"></div>' );
var $modal = $tpl.filter('.um-modal');
$modal.append( jQuery( '#' + id ) );
jQuery('body').append( $tpl );
if ( isPhoto ) {
var photo_ = jQuery('<img src="' + source + '" />'),
photo_maxw = jQuery(window).width() - 60,
photo_maxh = jQuery(window).height() - jQuery(window).height() * 0.25;
photo_.on( 'load', function() {
$modal.find('.um-modal-photo').html( photo_ );
$modal.addClass('is-photo').css({
'width': photo_.width(),
'margin-left': '-' + photo_.width() / 2 + 'px'
}).show().children().show();
photo_.css({
'opacity': 0,
'max-width': photo_maxw,
'max-height': photo_maxh
}).animate({'opacity' : 1}, 1000);
um_modal_responsive();
});
} else {
$modal.addClass('no-photo').show().children().show();
um_modal_size( size );
initImageUpload_UM( jQuery('.um-modal:visible .um-single-image-upload') );
initFileUpload_UM( jQuery('.um-modal:visible .um-single-file-upload') );
um_modal_responsive();
}
}
function prepare_Modal() {
if ( jQuery('.um-popup-overlay').length == 0 ) {
jQuery('body').append('<div class="um-popup-overlay"></div>');
jQuery('body').append('<div class="um-popup"></div>');
jQuery('.um-popup').addClass('loading');
overlayOpen();
}
}
Now both in Safari iOS and any other browser the body will lock when the modal opens, and after the modal is closed the page will return to the same spot when the modal opened.
-
This reply was modified 2 years, 4 months ago by Jack.