mirror of https://github.com/akveo/blur-admin
fix(mobile): detect mobile bu userAgent
parent
fdd0fc8623
commit
0a072e664e
|
@ -9,7 +9,7 @@
|
||||||
.directive('baPanelBlur', baPanelBlur);
|
.directive('baPanelBlur', baPanelBlur);
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
function baPanelBlur(baPanelBlurHelper, $window, $document) {
|
function baPanelBlur(baPanelBlurHelper, $window, $rootScope) {
|
||||||
var bodyBgSize;
|
var bodyBgSize;
|
||||||
|
|
||||||
baPanelBlurHelper.bodyBgLoad().then(function() {
|
baPanelBlurHelper.bodyBgLoad().then(function() {
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function($scope, elem) {
|
link: function($scope, elem) {
|
||||||
|
if(!$rootScope.$isMobile) {
|
||||||
baPanelBlurHelper.bodyBgLoad().then(function () {
|
baPanelBlurHelper.bodyBgLoad().then(function () {
|
||||||
setTimeout(recalculatePanelStyle);
|
setTimeout(recalculatePanelStyle);
|
||||||
});
|
});
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
$scope.$on('$destroy', function () {
|
$scope.$on('$destroy', function () {
|
||||||
$window.removeEventListener('resize', recalculatePanelStyle);
|
$window.removeEventListener('resize', recalculatePanelStyle);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function recalculatePanelStyle() {
|
function recalculatePanelStyle() {
|
||||||
if (!bodyBgSize) {
|
if (!bodyBgSize) {
|
||||||
|
|
|
@ -11,12 +11,20 @@
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
function themeRun($timeout, $rootScope, layoutSizes, layoutPaths, preloader, $q) {
|
function themeRun($timeout, $rootScope, layoutSizes, layoutPaths, preloader, $q) {
|
||||||
|
|
||||||
$q.all([
|
$rootScope.$isMobile = (/android|webos|iphone|ipad|ipod|blackberry|windows phone/).test(navigator.userAgent.toLowerCase());
|
||||||
preloader.loadImg(layoutPaths.images.root + 'blur-bg.jpg'),
|
var whatToWait = [
|
||||||
preloader.loadImg(layoutPaths.images.root + 'blur-bg-blurred.jpg'),
|
|
||||||
preloader.loadAmCharts(),
|
preloader.loadAmCharts(),
|
||||||
$timeout(3000)
|
$timeout(3000)
|
||||||
]).then(function(){
|
];
|
||||||
|
|
||||||
|
if ($rootScope.$isMobile) {
|
||||||
|
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg-mobile.jpg'));
|
||||||
|
} else {
|
||||||
|
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg.jpg'));
|
||||||
|
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg-blurred.jpg'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$q.all(whatToWait).then(function () {
|
||||||
$rootScope.$pageFinishedLoading = true;
|
$rootScope.$pageFinishedLoading = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<!-- endinject -->
|
<!-- endinject -->
|
||||||
<!-- endbuild -->
|
<!-- endbuild -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body ng-class="{'mobile' : $isMobile}">
|
||||||
<main ng-if="$pageFinishedLoading" ng-class="{ 'menu-collapsed': $isMenuCollapsed }">
|
<main ng-if="$pageFinishedLoading" ng-class="{ 'menu-collapsed': $isMenuCollapsed }">
|
||||||
|
|
||||||
<sidebar></sidebar>
|
<sidebar></sidebar>
|
||||||
|
|
|
@ -18,11 +18,6 @@ body {
|
||||||
@include main-background();
|
@include main-background();
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
body {
|
|
||||||
background-image: url($images-root + 'blur-bg-mobile.jpg');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,12 +82,6 @@ $panel-heading-font-size: 16px;
|
||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.panel-blur {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-primary {
|
.panel-primary {
|
||||||
> .panel-heading {
|
> .panel-heading {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
body.badmin-transparent {
|
body.badmin-transparent {
|
||||||
|
&.mobile{
|
||||||
|
background-image: url($images-root + 'blur-bg-mobile.jpg');
|
||||||
|
.panel-blur {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@include overrideColors(#fff);
|
@include overrideColors(#fff);
|
||||||
@include overridePanelBg(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.9));
|
@include overridePanelBg(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.9));
|
||||||
.default-color {
|
.default-color {
|
||||||
|
|
Loading…
Reference in New Issue