File tree Expand file tree Collapse file tree 4 files changed +47
-4
lines changed
Expand file tree Collapse file tree 4 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ html, body {
1010 height : 100% ;
1111}
1212
13+ # loading {
14+ position : absolute;
15+ z-index : 99 ;
16+ width : 100% ;
17+ height : 100% ;
18+ background : # 00A3D3 url ('../img/logo.png' ) no-repeat center center;
19+ }
20+
1321header {
1422 padding : 0 ;
1523 margin : 0 ;
Original file line number Diff line number Diff line change 2727 < script type ="text/javascript " language ="javascript " src ="js/app.js?nocache=1 "> </ script >
2828 </ head >
2929 < body onload ="load(); ">
30- < header >
30+
31+ < div id ="loading "> </ div >
32+
33+ < header style ="display: none ">
3134 < div class ="container ">
3235 < ol class ="nav ">
3336 < li class ="home "> </ li >
3437 < li class ="navigation "> </ li >
3538 < li class ="chasecar "> </ li >
3639 < li class ="stations "> </ li >
3740 </ ol >
38- < span id ="app_name "> < b > tracker</ b > </ span >
41+ < span id ="app_name "> < b > mobile < br /> tracker</ b > </ span >
3942 </ div >
4043 </ header >
4144
4245
43- < div id ="map "> </ div >
44- < div id ="main ">
46+
47+ < div id ="map " style ="dispaly: none "> </ div >
48+ < div id ="main " style ="dispaly: none ">
4549 < div class ="scrollwrapper ">
4650 < div class ="portrait "> </ div >
4751 < div class ="landscape "> </ div >
Original file line number Diff line number Diff line change 11var listScroll ;
2+ var nLoadedImages = 0 ;
3+ var preloadTimer ;
4+ var preloadImages = [
5+ "img/logo.png" ,
6+ "img/marker-you.png" ,
7+ "img/menu-icons.png" ,
8+ ] ;
29
310function hideAddressbar ( )
411{
512 window . scrollTo ( 0 , 1 ) ;
613}
714
15+ function checkPreload ( ) {
16+ }
17+
818
919$ ( window ) . ready ( function ( ) {
1020 window . onorientationchange = hideAddressbar ( ) ;
@@ -74,4 +84,25 @@ $(window).ready(function() {
7484 } ) ;
7585 } , 10000 ) ; // poll every 10sec;
7686 }
87+
88+ // preload images
89+ var i = 0 ;
90+ for ( i = 0 ; i < preloadImages . length ; i ++ ) {
91+ var image = new Image ( ) ;
92+ image . onLoad = ( function ( ) { nLoadedImages ++ ; } ) ( ) ;
93+ image . src = preloadImages [ i ] ;
94+ }
95+
96+ // check if images have loaded
97+ preloadTimer = setInterval ( function ( ) {
98+ if ( nLoadedImages < preloadImages . length ) return ;
99+ clearInterval ( preloadTimer ) ;
100+
101+ // app stars with a welcome screen
102+ // after images are loaded we can show the interface
103+ setTimeout ( function ( ) {
104+ $ ( '#loading' ) . hide ( ) ;
105+ $ ( 'header,#main,#map' ) . show ( ) ;
106+ } , 500 ) ;
107+ } , 100 ) ;
77108} ) ;
You can’t perform that action at this time.
0 commit comments