我正在开发一个带有 ionic-framework 和 Cordova 插件的混合应用程序。他们问我两个操作系统(iOS 和 Android)上的启动屏幕都有一个小动画。我想象的是 GIF,但如果您可以将 GIF 作为启动屏幕加载,则不会。或者是否有一个插件可以实现这一点。
您可以通过这种方式做到这一点,而无需使用插件。更多信息请点击这里 http://www.gajotres.net/using-views-events-to-create-javascript-pure-ionic-splash-screen/.
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/样式.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);
});
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)