启动画面中的GIF文件离子

NHT*_*res 13 android ios ionic-framework cordova-plugins

我正在开发一个带有离子框架和Cordova插件的混合应用程序.他们问我两个操作系统(iOS和Android)上的启动画面都有一个小动画.我想象一个GIF,但如果你可以加载GIF作为启动画面.或者如果有插件的话.

Tom*_*vic 5

你可以这样做而不使用插件.更多信息可在此处获得.

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>
Run Code Online (Sandbox Code Playgroud)

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;
}
Run Code Online (Sandbox Code Playgroud)

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);
  });  
});
Run Code Online (Sandbox Code Playgroud)