Foros del Web » Programando para Internet » Javascript »

¿Qué sucede con este cargador?

Estas en el tema de ¿Qué sucede con este cargador? en el foro de Javascript en Foros del Web. Hola, metí este código javascript en una sección de mi página web, para que tuviese un efecto de carga esa página, el script se llama ...
  #1 (permalink)  
Antiguo 02/01/2006, 14:46
 
Fecha de Ingreso: abril-2005
Mensajes: 77
Antigüedad: 19 años
Puntos: 0
¿Qué sucede con este cargador?

Hola,
metí este código javascript en una sección de mi página web, para que tuviese un efecto de carga esa página, el script se llama "js loader" y tiene 2 archivos, uno hay que colocarlo al principio de lo que se tiene que cargar y otro al final, se carga perfecto pero en la barra de estado de mi IE, sale como se va cargando, 1/13...2/13...3/13...(mi página debe de tener 13 elementos).
El problema es que cuando se carga es decir los 13/13 no desaparece de la barra de estado y se queda ahí quieto todo el rato, de vez en cuando parpadea, pero bueno el caso es que yo quiero que no haya nada en mi barra de estado.

A continuación les dejo el código, a ver si me dicen que necesito hacer con el:
PARTE 1,(la que se coloca al principio):
*/
//----------------------------------------------------------------------------------------------------
// Configuration
//----------------------------------------------------------------------------------------------------

var boxText = "Cargando Amiguetes"; // dialog box message
var boxFont = "bold 21px Thickhead"; // dialog box font (CSS spec: "style size family")
var boxFontColor = "#0545FF"; // dialog box font color
var boxWidth = 250; // dialog box width (pixels)
var boxHeight = 100; // dialog box height (pixels)
var boxBGColor = "#FFD000"; // dialog box background color
var boxBorder = "5px outset #E0E0E0"; // dialog box border (CSS spec: "size style color")

var barLength = 250; // progress bar length (pixels)
var barHeight = 25; // progress bar height (pixels)
var barColor = "#FF2C00"; // progress bar color
var barBGColor = "#FFB600"; // progress bar background color

var fadeInSpeed = 14; // content fade-in speed (0 - 30; 0 = no fading)*

// * Fading was successfully tested only on Windows XP with IE 6, NN 7 and Firefox 1. It seems that
// other browsers and systems do not support this feature.

//----------------------------------------------------------------------------------------------------
// Build dialog box and progress bar
//----------------------------------------------------------------------------------------------------

var safari = (navigator.userAgent.indexOf('Safari') != -1) ? true : false;

if((document.all || document.getElementById) && !safari) {
document.write('<style> .clsBox { ' +
'position:absolute; top:50%; left:50%; ' +
'width:' + boxWidth + 'px; ' +
'height:' + boxHeight + 'px; ' +
'margin-top:-' + Math.round(boxHeight / 2) + 'px; ' +
'margin-left:-' + Math.round(boxWidth / 2) + 'px; ' +
(boxBGColor ? 'background-color:' + boxBGColor + '; ' : '') +
(boxBorder ? 'border:' + boxBorder + '; ' : '') +
'z-index:99; ' +
'} .clsBarBG { ' +
'width:' + (barLength + 4) + 'px; ' +
'height:' + (barHeight + 4) + 'px; ' +
'background-color:' + barBGColor + '; ' +
'border-top:1px solid black; border-left:1px solid black; ' +
'border-bottom:1px solid silver; border-right:1px solid silver; ' +
'margin:0px; padding:0px; ' +
'} .clsBar { ' +
'width:0px; height:' + barHeight + 'px; ' +
'background-color:' + barColor + '; ' +
'border-top:1px solid silver; border-left:1px solid silver; ' +
'border-bottom:1px solid black; border-right:1px solid black; ' +
'margin:1px; padding:0px; ' +
'font-size:1px; ' +
'} .clsText { ' +
'font:' + boxFont + '; ' +
'color:' + boxFontColor + '; ' +
'} </style> ' +
'<div id="divBox" class="clsBox">' +
'<table border=0 cellspacing=0 cellpadding=0><tr>' +
'<td width=' + boxWidth + ' height=' + boxHeight + ' align=center>' +
(boxText ? '<p class="clsText" align=center>' + boxText + '</p>' : '') +
'<table border=0 cellspacing=0 cellpadding=0><tr><td width=' + barLength + '>' +
'<div id="divBarBG" class="clsBarBG"><div id="divBar" class="clsBar"></div></div>' +
'</td></tr></table>' +
'</td></tr></table></div>' +
'<div id="Content" style="width:100%; visibility:hidden">');
}

//----------------------------------------------------------------------------------------------------


PARTE 2, (la que se coloca al final):

*/
function LOADER() {
this.bar, this.iv, this.timer;
this.imgAll = this.opacity = 0;

this.getObj = function(id) {
var obj;
if(document.getElementById) obj = document.getElementById(id);
else if(document.all) obj = document.all[id];
return obj;
}

this.setOpacity = function(obj, opacity) {
if(obj && !document.layers) {
obj.style.filter = 'alpha(opacity=' + opacity + ')';
obj.style.mozOpacity = '.1';
if(obj.filters) obj.filters.alpha.opacity = opacity;
if(!document.all && obj.style.setProperty) obj.style.setProperty('-moz-opacity', opacity / 100, '');
}
}

this.fadeIn = function(id) {
var obj = this.getObj(id);
if(obj) {
if(document.all) obj.style.position = 'absolute';
obj.style.visibility = 'visible';
if(fadeInSpeed && this.opacity < 100) {
this.opacity += fadeInSpeed;
if(this.opacity > 100) this.opacity = 100;
this.setOpacity(obj, this.opacity);
if(this.timer) clearTimeout(this.timer);
this.timer = setTimeout("loader.fadeIn('" + id + "')", 1);
}
else {
this.opacity = 100;
this.setOpacity(obj, 100);
}
}
}

this.setBar = function() {
if(this.imgAll < document.images.length) this.imgAll = document.images.length;
for(var i = cnt = 0; i < this.imgAll; i++) {
if(document.images[i] && document.images[i].complete) cnt++;
else if(document.images[i].complete == null) cnt++;
}
var mul = barLength / this.imgAll;
var len = Math.round(cnt * mul);
if(len > barLength) len = barLength;
this.bar.style.width = len + 'px';
window.status = cnt + ' / ' + this.imgAll;
if(cnt >= this.imgAll) {
if(this.iv) clearInterval(this.iv);
setTimeout('loader.loaded()', 100);
}
}

this.init = function() {
this.bar = this.getObj('divBar');
if(document.images && document.images.length) {
if(this.iv) clearInterval(this.iv);
this.iv = setInterval('loader.setBar()', 100);
}
else loader.loaded();
}

this.loaded = function() {
window.status = '';
this.fadeIn('Content');
var obj = this.getObj('divBox');
obj.style.visibility = 'hidden';
}
}

//----------------------------------------------------------------------------------------------------
// Show dialog box and progress bar
//----------------------------------------------------------------------------------------------------
if((document.all || document.getElementById) && !safari) {
document.write('</div>');
var loader = new LOADER();
loader.init();
}


//----------------------------------------------------------------------------------------------------
  #2 (permalink)  
Antiguo 03/01/2006, 12:43
 
Fecha de Ingreso: abril-2005
Mensajes: 77
Antigüedad: 19 años
Puntos: 0
nadie puede echar un cable?
Es realmente importante para mi...

Un saludo y a ver si hay algo de suerte
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:19.