I'm trying to show a loading image in my pages using these functions:
$(document).ready(function(){
$(".loading").hide();
$.unblockUI();
$(".menuLink").focus(function() {
$(this).addClass('link-menu-selected');
});
$(".menuLink").blur(function() {
$(this).removeClass('link-menu-selected');
});
});
$(window).bind('beforeunload',function(){
$(".loading").show();
$.blockUI({message: null});
});
function exportFile(){
$('.loading').hide();
$.unblockUI();
}
But the image does not appear, the pages are loading properly without displaying the image, does anyone know what was going wrong, or if there are other ways to do it?
Not appear any error on the console, I put it in my main loading JS, a single JS centered where I put all my functions.
There are other ways to do this run in an efficient manner?
I add the following "libraries" also:
<script type="text/javascript" src="/sign/resources/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/sign/resources/js/jquery.blockUI.js"></script>
<script type="text/javascript" src="/sign/resources/js/renderAjax.js"></script>
I add this in a template page, "header", all pages of my application are using:
<ui:composition template="/layout/template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
That is to say, I wanted to do this in a general way, in a way that all the pages of my application to inherit this function "wait", thereby displaying the image.
Here an example, thats exactly what I want to do, I want to do the same thing in JSF2: