Avoid flickering when replacing CSS

This commit is contained in:
Thomas Gelf 2014-03-26 09:26:37 +00:00
parent 070573b9c0
commit 6e9ea3a5d1
1 changed files with 11 additions and 6 deletions

View File

@ -77,16 +77,21 @@
},
reloadCss: function () {
var utils = this.icinga.utils;
var icinga = this.icinga;
$('link').each(function() {
if ($(this).attr('type').indexOf('css') > -1) {
$(this).attr(
var $oldLink = $(this);
if ($oldLink.attr('type').indexOf('css') > -1) {
var $newLink = $oldLink.clone().attr(
'href',
utils.addUrlParams(
icinga.utils.addUrlParams(
$(this).attr('href'),
[ { name: 'id', value: new Date().getTime() } ]
{ id: new Date().getTime() }
)
);
).on('load', function() {
icinga.ui.fixControls();
$oldLink.remove();
});
$newLink.appendTo($('head'));
}
});
},