期待喜欢 - http://www.thepetedesign.com/demos/youtube_loadingbar_demo.html
我正在研究 Ajax 加载器,像 ajax 加载器这样的 Youtube 给我留下了深刻的印象。
在尝试这个加载器之前,我通常用这种方式加载 ajax 加载器——
每当ajax启动时,完成-
<script type="text/javascript">
$(function () {
$('.loader').ajaxStart(function () {
$(this).fadeIn();
}).ajaxComplete(function () {
$('.loader').fadeOut();
});
$(window).load(function () {
$('.loader2').fadeOut();
});
});
</script>
HTML-
<div class="loader">
<img src="../../Images/AjaxLoader.gif" /></div>
<div class="loader2">
<img src="../../Images/AjaxLoader.gif" /></div>
我正在使用图像并在 ajax 开始和结束功能上显示和隐藏它们。
现在我想像加载器一样使用 youtube-
对于一个简单的链接,它工作正常 -
<a id="clickme">Click me</a>
<script type="text/javascript">
$(document).ready(function () {
$("a").loadingbar({
done:function({});
});
});
</script>
我无法在每个 ajax 启动和完成功能上使用这个 ajax 加载器。
我试过了-
<script type="text/javascript">
$(function () {
$('a').ajaxStart(function () {
$(this).loadingbar();
}).ajaxComplete(function () {
$(this).loadingbar();
});
});
</script>
我希望这个 ajax 加载器出现在应用程序中的每个 ajax 请求上。如何才能做到这一点?