rsmoraes 14 de mar. de 2012
eu tenho um Load em JQUERY… vou disponibilizar aqui… mas este load, ele abre em uma div… eu queria um AUTO LOAD… independente da página, ele fazer o LOAD…(uma imagemzinha)…
Segue abaixo o load:
< script type = "text/javascript" >
$ ( document ) . ready (
function () {
var content = $ ( '#content' );
// pre carregando o gif
loading = new Image ();
loading . src = 'carregando.gif' ;
$ ( '#menu a' ) . live (
'change' ,
function ( e ) {
e . preventDefault ();
content . html ( '<img src="carregando.gif" />' );
var href = $ ( this ) . attr ( 'action' );
$. ajax ({
url : href ,
success : function ( response ) {
// forçando o parser
var data = $ ( '<div>' + response + '</div>' )
. find ( '#content' ) . html ();
// apenas atrasando a troca , para mostrarmos o loading
window . setTimeout ( function () {
content . fadeOut ( 'slow' , function () {
content . html ( data ) . fadeIn ();
});
}, 500 );
}
});
});
});
</ script >
< ul id = "menu" >
< li >< a href = "galerias.jsp" > Galeria </ a ></ li >
< li >< a href = "fotos.jsp" > Fotos </ a ></ li >
< li >< a href = "contato.jsp" > Contato </ a ></ li >
</ ul >
< div id = "content" >
// Aqui tem o Conteúdo das páginas JSP ....
</ div >
Entendeu ? eu queria um AutoLoad que ao entrar na página ele já acionasse o LOAD até o carregamento da mesma fosse concluído… parecido com um SLOW…
Heelp… srrs
ErickMacedo 14 de mar. de 2012
Está usando algum framework, JSF por exemplo?
rsmoraes 14 de mar. de 2012
Infelizmente não… estou utlizando Servlet + JSP…
rsmoraes 14 de mar. de 2012
Eu estava dando uma olhada… e vi isto:
<script>
function load(){
alert('PAGINA CARREGADA');
}
</script>
<body onload= "load()" >
</body>
Este ai é quando a página foi carregada totalmente… queria um que a página ainda não foi carregada… ai eu jogava um GIF girando bem no centro dela… seria um load…
entenderam amigos ?
rsmoraes 14 de mar. de 2012
É simples…
Adicione ao seu
< STYLE type = text / css >
#divLoadCont { position : absolute ; width : 100 % ; height : 100 % ; top : 0 ; left : 0 ;
background - color : white ; layer - background - color : white ; font - family : arial , helvetica ;
z - index : 100 }
</ STYLE >
< script type = "text/javascript" language = "JavaScript" >
function checkBrowser () {
this . ver = navigator . appVersion
this . dom = document . getElementById ? 1 : 0
this . ie6 = ( this . ver . indexOf ( "MSIE 6" ) >- 1 && this . dom ) ? 1 : 0 ;
this . ie5 = ( this . ver . indexOf ( "MSIE 5" ) >- 1 && this . dom ) ? 1 : 0 ;
this . ie4 = ( document . all && ! this . dom ) ? 1 : 0 ;
this . ns5 = ( this . dom && parseInt ( this . ver ) >= 5 ) ? 1 : 0 ;
this . ns4 = ( document . layers && ! this . dom ) ? 1 : 0 ;
this . bw = ( this . ie6 || this . ie5 || this . ie4 || this . ns4 || this . ns5 )
return this
}
bw = new checkBrowser ()
function hideIt ( div ) {
if ( bw . bw ) {
div = "divLoadCont"
obj = bw . dom ? document . getElementById ( div ). style : bw . ie4 ? document . all [ div ] . style : bw . ns4 ?
document [ div ] : 0 ;
obj . visibility = 'hidden'
}
}
onload = hideIt ;
</ script >
// O seu body fica assim :
< body TOPMARGIN = "0" LEFTMARGIN = "0" SCROLL = "NO" >
// Logo abaixo , coloque isso :
< script >
if ( bw . bw )
document . write ( '<div id="divLoadCont"><table width="100%" height="100%" align="center" valign="middle"><tr><td width="100%" height="100%" align="center" align="middle"><FONT FACE="Verdana" SIZE="2" COLOR="#000000"><B>... Carregando...</B></FONT></td></tr></table></div>' )
</ script >
Ta ai a solução, molezinha… rsrsrs
Obrigado pela ajuda.