Jump to content
Fórum Script Brasil
  • 0

Preloader


Sued

Question

4 answers to this question

Recommended Posts

  • 0

Sim, é possível, siga o exemplo:

<div id="mensagem" style="width:100%;height:100%;position=absolute">

<table width="100%" height="100%" bgcolor="#FFFFFF">

<tr>

<td align="center" valign="middle">

Aguarde, carregando...

</td>

</tr>

</table>

<script>

function some()

{

document.all.mensagem.style.visibility='hidden';

}

</script>

<body onLoad="some()">

Link to comment
Share on other sites

  • 0

1. nesse você especifica os arquivos a serem pré-caregados

<script language="JavaScript1.1">var locationAfterPreload = "file:///C|/Documents and Settings/All Users/Desktop/pics/proxnew/layout.htm" // URL of the page after preload finishes
var lengthOfPreloadBar = 238 // Length of preload bar (in pixels)
var heightOfPreloadBar = 10 // Height of preload bar (in pixels)
// Put the URLs of images that you want to preload below (as many as you want)
var yourImages = new Array("","","file:///C|/Documents and Settings/All Users/Desktop/pics/proxnew/about2.gif")
// Do not modify anything beyond this point!
if (document.images) {
var dots = new Array() 
dots[0] = new Image(1,1)
dots[0].src = "pixel1.gif" // default preloadbar color (note: You can substitute it with your image, but it has to be 1x1 size)
dots[1] = new Image(1,1)
dots[1].src = "pixel2.gif" // color of bar as preloading progresses (same note as above)
var preImages = new Array(),coverage = Math.floor(lengthOfPreloadBar/yourImages.length),currCount = 0
var loaded = new Array(),i,covered,timerID
var leftOverWidth = lengthOfPreloadBar%coverage
}
function loadImages() { 
for (i = 0; i < yourImages.length; i++) { 
    preImages[i] = new Image()
    preImages[i].src = yourImages[i]
}
for (i = 0; i < preImages.length; i++) { 
    loaded[i] = false
}
checkLoad()
}
function checkLoad() {
if (currCount == preImages.length) { 
    location.replace(locationAfterPreload)
    return
}
for (i = 0; i <= preImages.length; i++) {
    if (loaded[i] == false && preImages[i].complete) {
  loaded[i] = true
  eval("document.img" + currCount + ".src=dots[1].src")
  currCount++    }
}
timerID = setTimeout("checkLoad()",10) 
}
// end hiding -->
</script>
<script language="JavaScript1.1">var locationAfterPreload = "new/layout.htm" // URL of the page after preload finishes
var lengthOfPreloadBar = 238 // Length of preload bar (in pixels)
var heightOfPreloadBar = 5 // Height of preload bar (in pixels)
// Put the URLs of images that you want to preload below (as many as you want)
var yourImages = new Array("new/about2.gif","new/aboutb.gif","new/arrow.gif","new/arrowback.gif","new/art2.gif",
"new/artb.gif","new/back.gif","new/bottom01.gif","new/bottom02.gif","new/bottom03.gif",
"new/bottom04.gif","new/bottom05.gif","new/contact2.gif","new/contactb.gif","new/gbook2.gif",
"new/gbookb.gif","new/imagethingdown.gif","new/imagethingempty.gif","new/imagethingup.gif",
"new/left01.gif","new/left02.gif","new/left03.gif","new/left04.gif","new/left05.gif","new/link2.gif","
new/linkb.gif","new/loaderbottom.gif","new/loaderleft.gif","new/loaderright.gif","new/loadertop.gif"
,"new/loading.gif","new/navback.gif","new/newarrow.gif","new/news2.gif","new/newsb.gif",
"new/partnersb.gif","new/partnersover.gif","new/pixel1.gif","new/proxnew.gif","new/right01.gif",
"new/right02.gif","new/right03.gif","new/right04.gif","new/right05.gif","new/title.gif","new/top02.gif",
"new/top03.gif","new/top04.gif","new/top05.gif","new/top.gif","new/upcoming2.gif",
"new/upcomingb.gif","new/web2.gif","new/webb.gif")
// Do not modify anything beyond this point!
if (document.images) {
var dots = new Array() 
dots[0] = new Image(1,1)
dots[0].src = "pixel1.gif" // default preloadbar color (note: You can substitute it with your image, but it has to be 1x1 size)
dots[1] = new Image(1,1)
dots[1].src = "pixel2.gif" // color of bar as preloading progresses (same note as above)
var preImages = new Array(),coverage = Math.floor(lengthOfPreloadBar/yourImages.length),currCount = 0
var loaded = new Array(),i,covered,timerID
var leftOverWidth = lengthOfPreloadBar%coverage
}
function loadImages() { 
for (i = 0; i < yourImages.length; i++) { 
    preImages[i] = new Image()
    preImages[i].src = yourImages[i]
}
for (i = 0; i < preImages.length; i++) { 
    loaded[i] = false
}
checkLoad()
}
function checkLoad() {
if (currCount == preImages.length) { 
    location.replace(locationAfterPreload)
    return
}
for (i = 0; i <= preImages.length; i++) {
    if (loaded[i] == false && preImages[i].complete) {
  loaded[i] = true
  eval("document.img" + currCount + ".src=dots[1].src")
  currCount++    }
}
timerID = setTimeout("checkLoad()",10) 
}
// end hiding -->
</script>
2. Pré-loading do site
<style type="text/css">
#divLoadCont{position:absolute; width:100%; height:98%; 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.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.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
bw=new checkBrowser()
//Hides the div
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>
</HEAD>
<BODY bgcolor="White">
    <script>
    //We write the table and the div to hide the content out, so older browsers won't see it
    if(bw.bw) document.write('<div id="divLoadCont"><table width="100%" height="95%" align="center" valign="middle"><tr><td width="100%" height="100%" align="center" valign="middle"><h3>Loading Page....</h3></td></tr></table></div>')
    </script>

SEU SITE VEM AQUI....
</BODY>
</HTML>

era isso que você queria?

espero ter ajudado.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...