I'm trying to display a loading image on 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, ie the pages are loading correctly without displaying the image, does anyone know what is going wrong, or are there other ways to do this?
There is no error in the console, I put it in my main load JS, a single JS where I centralize all my functions.
Are there other ways to do this in an efficient way?
I add the following "libraries" too:
<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 to a template page, "header", which all pages in my application use:
<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"
I mean, I wanted to do this in a generalized way, in a way that all the pages of my application inherit this "wait" function, thus displaying this image.
I want to do this, but not in php, in JSF2: