【问题标题】:How to wait for a website to totally load before displaying it on the screen (ionic app development)?如何等待网站完全加载后再将其显示在屏幕上(离子应用程序开发)?
【发布时间】:2016-08-05 09:14:15
【问题描述】:

我正在开发一个离子移动应用程序。我想加载一个网站并在完全加载后将其显示在屏幕上。在等待网站加载时,我想要一张背景图片和一个微调器,向用户指示他/她必须等待。 下面是我用来加载网站的代码(在 app.js 文件中)。但是,我不确定该命令应该放在哪里。

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    window.open('https://www.google.com', '_self', 'location=no');
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
      }
    if(window.StatusBar) {
      StatusBar.styleDefault();
     }
  });
})    

在 index.html 文件中:

<ion-pane>
  <ion-header-bar class="bar-stable">
    <h1 class="title" aligh=center >Starter</h1>
  </ion-header-bar>
  <ion-content> 
  <ion-spinner icon="spiral"></ion-spinner>
  </ion-content>
</ion-pane>

我是否需要控制器来完成任务(知道网站何时准备就绪并显示它)?

【问题讨论】:

标签: android javascript css ios


【解决方案1】:

也许你可以写成

$(window).load(function(){ ... });

【讨论】:

    猜你喜欢
    • 2011-08-26
    • 2021-02-05
    • 1970-01-01
    • 1970-01-01
    • 2017-02-03
    • 2015-03-23
    • 2021-05-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多