2015-07-10 56 views
10

我正在開發與離子框架和Cordova插件的混合應用程序。他們問我兩個操作系統(iOS和Android)上的啓動畫面都有一個小動畫。我想象一個GIF,但不是如果你可以加載一個GIF作爲閃屏。或者如果有這樣的插件。啓動畫面中的GIF文件Ionic

+0

如果你想包括在GIF你的屏幕然後你可以參考這個鏈接http://droid-blog.net/2011/10/14/tuto rial-how-to-use-animated-gifs-in-android-part-1/ –

+0

嗨,如果你能夠實現它,請分享答案。 –

回答

5

你可以這樣做,而無需使用插件。 More information is available here

HTML

<body> 
     <div id="custom-overlay"><img src="http://cdn.osxdaily.com/wp-content/uploads/2013/07/dancing-banana.gif"></div> 
     <!-- Here comes rest of the content --> 
    </body> 

WWW/CSS/的style.css

#custom-overlay { 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    position: fixed; 
    top: 0; 
    right: 0; 
    bottom: 0; 
    left: 0; 
    z-index: 100; 
    background-color: #fe201f; 
} 

#custom-overlay img { 
    display: block; 
    margin: 0 auto; 
    width: 60%; 
    height: auto; 
} 

WWW/JS/app.js

.run(function($ionicPlatform, $state, $cordovaSplashscreen) { 
     $ionicPlatform.ready(function() { 
     if(navigator.splashscreen) { 
     $cordovaSplashscreen.hide(); 
     } 
     }); 
    }); 

.controller('ListCtrl', function($scope) { 
    $scope.$on('$ionicView.afterEnter', function(){ 
    setTimeout(function(){ 
     document.getElementById("custom-overlay").style.display = "none";  
    }, 3000); 
    }); 
}); 
+0

你好 在我的情況下,會認爲我實現你代碼: - 這飛濺加載, - 的ListCtrl頁面將顯示很短的時間(毫秒) - 自定義開機畫面顯示 - 列表按Ctrl頁面顯示。 – Bassam