I have an ons-page loading with an image as a background. At the first startup of the app an ons-dialog pops up and asks user for some information. When it pops up, it seems the page behind it's background css, doesn't load properly every time.
Sometimes the background image (visible since the ons-dialog isn't full screen) loads correctly. Other times it loads the image at full size and doesn't re-size it according to my css.
My css for the ons-page (behind the popup):
.details-content{
background-image: url('images/bg_beer.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
Code for showing my dialog:
ons.ready(function() { $scope.show('welcomePopup.html'); });
Any help as to why my css isn't always done loading when ons.ready() is being fired, a fix, or a workaround would be very much appreciated.
EDIT 1:
angular controller:
app.controller('homeCon', function($http, $scope, $compile, $sce, $window, filterFilter, $timeout){
document.addEventListener("show", function(event){
if (event.target.id == "myMainPage") {
$scope.show('welcomePopup.html');
}
},false);
...
...
};
HTML for my opening page:
.details-content{
background-image: url('images/bg_beer.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover; }
</style>
<ons-page class="transparent" ng-controller="homeCon" id="myMainPage"> <ons-toolbar modifier="transparent">
<div class="right">
<ons-toolbar-button><ons-icon icon="ion-ios-location" style="color: white; font-size: 28px;"></ons-icon></ons-toolbar-button>
</div>
<div class="left">
<ons-toolbar-button ng-click="menu.toggle()"><ons-icon icon="fa-bars" style="color: white; font-size: 28px;" fixed-width="false"></ons-icon></ons-toolbar-button>
</div> </ons-toolbar> <div> <div class="details-content glass">
<div class="welcome" style="top:30%">
<img src="images/bm_logo.png" width="66%">
</br>
<div ng-view>
<ons-button modifier="quiet" style="color:white" ng-click="openFB()"><i class="fa fa-facebook-square fa-3x"></i></ons-button>
<ons-button modifier="quiet" style="color:white" ng-click="openInsta()"><i class="fa fa-instagram fa-3x"></i></ons-button>
<ons-button modifier="quiet" style="color:white" ng-click="openTwitter()"><i class="fa fa-twitter-square fa-3x"></i></ons-button>
</div>
</div> </div> <div>
</ons-page>