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);
|
||||
|
||||
/** @ngInject */
|
||||
function baPanelBlur(baPanelBlurHelper, $window, $document) {
|
||||
function baPanelBlur(baPanelBlurHelper, $window, $rootScope) {
|
||||
var bodyBgSize;
|
||||
|
||||
baPanelBlurHelper.bodyBgLoad().then(function() {
|
||||
|
@ -23,14 +23,16 @@
|
|||
return {
|
||||
restrict: 'A',
|
||||
link: function($scope, elem) {
|
||||
baPanelBlurHelper.bodyBgLoad().then(function() {
|
||||
setTimeout(recalculatePanelStyle);
|
||||
});
|
||||
$window.addEventListener('resize', recalculatePanelStyle);
|
||||
if(!$rootScope.$isMobile) {
|
||||
baPanelBlurHelper.bodyBgLoad().then(function () {
|
||||
setTimeout(recalculatePanelStyle);
|
||||
});
|
||||
$window.addEventListener('resize', recalculatePanelStyle);
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
$window.removeEventListener('resize', recalculatePanelStyle);
|
||||
});
|
||||
$scope.$on('$destroy', function () {
|
||||
$window.removeEventListener('resize', recalculatePanelStyle);
|
||||
});
|
||||
}
|
||||
|
||||
function recalculatePanelStyle() {
|
||||
if (!bodyBgSize) {
|
||||
|
|
|
@ -6,22 +6,30 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.theme')
|
||||
.run(themeRun);
|
||||
.run(themeRun);
|
||||
|
||||
/** @ngInject */
|
||||
function themeRun($timeout, $rootScope, layoutSizes, layoutPaths, preloader, $q) {
|
||||
|
||||
$q.all([
|
||||
preloader.loadImg(layoutPaths.images.root + 'blur-bg.jpg'),
|
||||
preloader.loadImg(layoutPaths.images.root + 'blur-bg-blurred.jpg'),
|
||||
$rootScope.$isMobile = (/android|webos|iphone|ipad|ipod|blackberry|windows phone/).test(navigator.userAgent.toLowerCase());
|
||||
var whatToWait = [
|
||||
preloader.loadAmCharts(),
|
||||
$timeout(3000)
|
||||
]).then(function(){
|
||||
$rootScope.$pageFinishedLoading = true;
|
||||
];
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
$timeout(function () {
|
||||
if(!$rootScope.$pageFinishedLoading){
|
||||
if (!$rootScope.$pageFinishedLoading) {
|
||||
$rootScope.$pageFinishedLoading = true;
|
||||
}
|
||||
}, 7000);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<!-- endinject -->
|
||||
<!-- endbuild -->
|
||||
</head>
|
||||
<body>
|
||||
<body ng-class="{'mobile' : $isMobile}">
|
||||
<main ng-if="$pageFinishedLoading" ng-class="{ 'menu-collapsed': $isMenuCollapsed }">
|
||||
|
||||
<sidebar></sidebar>
|
||||
|
|
|
@ -18,11 +18,6 @@ body {
|
|||
@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)
|
||||
{
|
||||
|
|
|
@ -82,12 +82,6 @@ $panel-heading-font-size: 16px;
|
|||
transition: none;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.panel-blur {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.panel-primary {
|
||||
> .panel-heading {
|
||||
color: $primary;
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
body.badmin-transparent {
|
||||
&.mobile{
|
||||
background-image: url($images-root + 'blur-bg-mobile.jpg');
|
||||
.panel-blur {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
@include overrideColors(#fff);
|
||||
@include overridePanelBg(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.9));
|
||||
.default-color {
|
||||
|
|
Loading…
Reference in New Issue