GIF File in splash screen Ionic

前端 未结 1 1896
盖世英雄少女心
盖世英雄少女心 2021-02-05 14:16

I am developing a hybrid application with ionic-framework and Cordova plugins. They asked me the splash screen on both operating systems (iOS and Android) has a small animation.

1条回答
  •  执念已碎
    2021-02-05 15:02

    You can do it this way without using plugins. More information is available here.

    HTML

     
           

    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 讨论(0)
提交回复
热议问题