0
我想申请启动加载微调在我的网页。 当用户点击页面时,它会加载文件并显示在网页上,用户可以通过点击刷新按钮来重新生成文件。 我想显示加载微调器,因为会有一些延迟加载文件在网页上,以及当用户点击刷新按钮,在网页中生成和加载文件。页面加载时无法显示加载图标 - 引导
的html代码:
<div ng-controller="getFileToShow">
<div><button ng-click="loadData()">Refresh</button>
<div>
<object standby="loading" id="htmlFrame" ng-attr-data="{{fileName}}" type="application/pdf" width="100%" height="100%">asa
<iframe ng-src="{{fileName}}" width="100%" height="100%" style="border: none;">
This browser does not support PDFs. Please download the PDF to view it:
</iframe>
</object>
</div>
</div>
</div>
JS代码:
app.controller('getFileToShow', function ($scope,MyAppService) {
$scope.getFileToShow = function() {
MyAppService.getFileToShow().then(
function (response) {
$scope.fileName = response;
},
function (errResponse) {
});
}
$scope.getFileToShow();
});
//service call
myAppService.getFileToShow = function(){
var Url = myURL+'/myAppData/getFileToShow.form';
$http.get(repUrl).then(
function (response) {
//logic here
},
);
return deferred.promise;
}
我从https://www.w3schools.com/howto/howto_css_loader.asp试图
CSS:
.loader {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
无法能够应用加载微调在我上面提到的HTML代码。任何意见将是有益的。如何在页面仍在加载时显示加载图标以显示网页上的文件(我的上面的html代码用于显示网页上的文件)。同样,当用户再次单击刷新按钮时,将需要一些时间来重新生成文件并将新创建的文件重新加载到显示旧文件的网页。
@lan - 我不希望使用任何额外的jar文件。如果你看到链接https://www.w3schools.com/howto/howto_css_loader.asp它非常简单。我想用这个来实现。即使在加载页面之后,问题仍会在网页上看到微调器。如果你看到我的js代码,我检索的文件是动态的,我不能给任何超时,因为我们无法预测加载/生成文件和加载需要多长时间。 – DIM
正是这就是为什么在js它说window.ready这意味着该页面已准备就绪,并且在页面加载后1000毫秒后淡出之后。 – Ian