mirror of https://github.com/akveo/blur-admin
refactor(blurFeature): use atachment fixed
parent
817e19eabf
commit
85274b90b2
|
@ -26,7 +26,6 @@
|
||||||
baPanelBlurHelper.bodyBgLoad().then(function() {
|
baPanelBlurHelper.bodyBgLoad().then(function() {
|
||||||
setTimeout(recalculatePanelStyle);
|
setTimeout(recalculatePanelStyle);
|
||||||
});
|
});
|
||||||
$document.on('scroll', recalculatePanelStyle);
|
|
||||||
$window.addEventListener('resize', recalculatePanelStyle);
|
$window.addEventListener('resize', recalculatePanelStyle);
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
$scope.$on('$destroy', function() {
|
||||||
|
@ -37,10 +36,9 @@
|
||||||
if (!bodyBgSize) {
|
if (!bodyBgSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var position = elem[0].getBoundingClientRect();
|
|
||||||
elem.css({
|
elem.css({
|
||||||
backgroundSize: Math.round(bodyBgSize.width) + 'px ' + Math.round(bodyBgSize.height) + 'px',
|
backgroundSize: Math.round(bodyBgSize.width) + 'px ' + Math.round(bodyBgSize.height) + 'px',
|
||||||
backgroundPosition: Math.floor(-position.left + bodyBgSize.positionX) + 'px ' + Math.floor(-position.top + bodyBgSize.positionY) + 'px'
|
backgroundPosition: Math.floor(bodyBgSize.positionX) + 'px ' + Math.floor(bodyBgSize.positionY) + 'px'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
finalWidth = elemW;
|
finalWidth = elemW;
|
||||||
finalHeight = (elemW * imgRatio);
|
finalHeight = (elemW * imgRatio);
|
||||||
}
|
}
|
||||||
return { width: finalWidth, height: finalHeight, positionX: (elemW - finalWidth) / 2, positionY: (elemH - finalHeight) / 2 };
|
return { width: finalWidth, height: finalHeight, positionX: (elemW - finalWidth)/2, positionY: (elemH - finalHeight)/2};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue