mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
js: Prevent flickering when refreshing scrolled content
This commit is contained in:
parent
27569d09d8
commit
f54f2f8627
@ -893,14 +893,15 @@
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollPos !== false) {
|
|
||||||
setTimeout($container.scrollTop.bind($container), 0, scrollPos);
|
|
||||||
}
|
|
||||||
var icinga = this.icinga;
|
var icinga = this.icinga;
|
||||||
//icinga.events.applyHandlers($container);
|
//icinga.events.applyHandlers($container);
|
||||||
icinga.ui.initializeControls($container);
|
icinga.ui.initializeControls($container);
|
||||||
icinga.ui.fixControls();
|
icinga.ui.fixControls();
|
||||||
|
|
||||||
|
if (scrollPos !== false) {
|
||||||
|
$container.scrollTop(scrollPos);
|
||||||
|
}
|
||||||
|
|
||||||
// Re-enable all click events (disabled as of performance reasons)
|
// Re-enable all click events (disabled as of performance reasons)
|
||||||
// $('*').off('click');
|
// $('*').off('click');
|
||||||
},
|
},
|
||||||
|
@ -567,18 +567,22 @@
|
|||||||
|
|
||||||
$container.find('.controls').each(function() {
|
$container.find('.controls').each(function() {
|
||||||
var $controls = $(this);
|
var $controls = $(this);
|
||||||
if (! $controls.next('.fake-controls').length) {
|
if (! $controls.prev('.fake-controls').length) {
|
||||||
var $tabs = $controls.find('.tabs', $controls);
|
var $tabs = $controls.find('.tabs', $controls);
|
||||||
if ($tabs.length && $controls.children().length > 1 && ! $tabs.next('.tabs-spacer').length) {
|
if ($tabs.length && $controls.children().length > 1 && ! $tabs.next('.tabs-spacer').length) {
|
||||||
$tabs.after($('<div class="tabs-spacer"></div>'));
|
$tabs.after($('<div class="tabs-spacer"></div>'));
|
||||||
}
|
}
|
||||||
var $fakeControls = $('<div class="fake-controls"></div>');
|
var $fakeControls = $('<div class="fake-controls"></div>');
|
||||||
$fakeControls.height($controls.height()).css({
|
$fakeControls.height($controls.height()).css({
|
||||||
display: 'block'
|
// That's only temporary. It's reset in fixControls, which is called at the end of this
|
||||||
|
// function. Its purpose is to prevent the content from jumping up upon auto-refreshes.
|
||||||
|
// It works by making the fake-controls appear at the same vertical level as the controls
|
||||||
|
// and the height of the content then doesn't change when taking the controls out of the flow.
|
||||||
|
float: 'right'
|
||||||
});
|
});
|
||||||
$controls.css({
|
$controls.before($fakeControls).css({
|
||||||
position: 'fixed'
|
position: 'fixed'
|
||||||
}).after($fakeControls);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -669,12 +673,15 @@
|
|||||||
|
|
||||||
$container.find('.controls').each(function() {
|
$container.find('.controls').each(function() {
|
||||||
var $controls = $(this);
|
var $controls = $(this);
|
||||||
var $fakeControls = $controls.next('.fake-controls');
|
var $fakeControls = $controls.prev('.fake-controls');
|
||||||
|
$fakeControls.css({
|
||||||
|
float: '', // Set by initializeControls
|
||||||
|
height: $controls.height()
|
||||||
|
});
|
||||||
$controls.css({
|
$controls.css({
|
||||||
top: $container.offsetParent().position().top,
|
top: $container.offsetParent().position().top,
|
||||||
width: $fakeControls.outerWidth()
|
width: $fakeControls.outerWidth()
|
||||||
});
|
});
|
||||||
$fakeControls.height($controls.height());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var $statusBar = $container.children('.monitoring-statusbar');
|
var $statusBar = $container.children('.monitoring-statusbar');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user