5 Lis 2013

Wyświetlenie okienka ładowania na środku ekranu

Wyświetlenie okienka ładowania na środku ekranu:

var winH = $(window).height();
var winW = $(window).width();
var loading = $('#loading');
var maxheight = loading.css("max-height");
var maxwidth = loading.css("max-width");
var loading_height = loading.height();
var loading_width = loading.width();
if (maxheight != "none") {
loading_height = Number(maxheight.replace("px", ""));
}
if (maxwidth != "none") {
loading_width = Number(maxwidth.replace("px", ""));
}
loading.css('top', winH / 2 + $(window).scrollTop() - loading_height / 2);
loading.css('left', winW / 2 - loading_width / 2);
$('#loading').show();