T
T
Timur Evgazhukov2016-05-20 13:35:09
Mobile development
Timur Evgazhukov, 2016-05-20 13:35:09

How to get rid of unwanted artifacts when running phonegap app?

I created a mobile application on jquery mobile and using phonegap, everything works fine, the only thing is that when the application is launched, clumsy html is displayed on the screen literally for a split second, and after (apparently the styles are loaded) everything returns to normal. All pages in one file.
How to get rid of this unpleasant artifact?
3c901e583f8d4331bd16d35e38964240.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
idclev31, 2016-05-20
@evgajukov

You can display, for example, the logo in full screen, while the styles are loading.
Then, layout without css will not be visible.

T
Timur Evgazhukov, 2016-05-21
@evgajukov

What I did:
1. Immediately after the body tag, I added a preloader block
2. In the header, I added styles to it
#page-preloader {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: #fff;
z-index: 100500;
}
#page-preloader .spinner {
width: 192px;
height: 192px;
position: absolute;
left: 50%
top: 50%;
background: url('img/logo.png') no-repeat 50% 50%;
margin: -96px 0 0 -96px;
}
3. And the full page load event handler
$(window).on('load', function () {
var $preloader = $('#page-preloader'), $spinner = $preloader.find('.spinner' );
$spinner.fadeOut();
$preloader.delay(350).fadeOut('slow');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question