Jump to content
xisto Community
naurus

DHTML Fade-in/out Loading Bar (Firefox Only)

Recommended Posts

Today I was looking around for a good DHTML loading bar and couldn't find one so I decided to make it myself!

Here is the javascript that goes into the <head> part of the doc:

var x = 0;var y = 115;var a = 0;setTimeout(fadeIn, 1);function fadeIn(){document.getElementById("003").style.opacity=a;a = a+.1;if(a<1.1){setTimeout(fadeIn, 100);}else{setTimeout(progressBar, 1);}}function progressBar(){x = x+1;document.getElementById("001").style.width=x;document.getElementById("002").style.width=x;if(x<113){setTimeout(progressBar, 1);}else{setTimeout(fadeOut, 1000);}}function fadeOut(){document.getElementById("003").style.opacity=a;a = a-.1;if(a!=0){setTimeout(fadeOut, 100);}}

And here is the table that I put the bars and text in:
<table id="003" style="opacity: 0; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="vertical-align: top; text-align: center;"><hr id="001" style="border: 1px solid rgb(51, 119, 255); margin-bottom: 0px; height: 2px; width: 0px;" noshade="noshade"></td></tr><tr><td align="center" valign="top"><span style="color: rgb(51, 119, 255);">Loading Conent</span></td></tr><tr align="center"><td style="vertical-align: top;"><hr id="002" style="border: 1px solid rgb(51, 119, 255); margin-top: 1px; height: 2px; width: 0%;" noshade="noshade"></td></tr></tbody></table>

Sorry, but this only works in FF, but with a little tweaking it could work in IE and Opera.

Post if you have any Q's!

Share this post


Link to post
Share on other sites

Although I could easily load this up and take a look at it, but it would be good to have a live demo link to show us what it looks like.Also your tables info could be converted to css as well make the coding look cleaner as well.

Share this post


Link to post
Share on other sites

I went for the bother to copy and paste and run it it browser. And it looked quite neat actually! I've been considering dhtml menus for me new site design and a loader like this would be quite neat. By the way, I tested in Opera 9.02 too and worked like a charm. And if it works in Firefox it'll work with all modern Gecko based browsers like Netscape and Mozilla. So I guess your script just doesn't work in IE. And we don't really care, right? :)

Share this post


Link to post
Share on other sites

For hercco: Well, most people do use IE (which sucks!), so I will probably fix that by changing some of the CSS.For saint-michael: I made the tables in a WYSIWYG editor (NVU) but I could edit them manually if I needed to (the javascript is all original). And one of the reasons I posted this is that I need a good place to host my schools debate site, (which needs smtp).

Share this post


Link to post
Share on other sites

Well for demo purposes you could use Xisto.net services you don't have to post, just have to deal with the ads. But since it is a demo you shouldn't have to worry about it.But to fix the problems you will have to convert it to css.Regardless if your a opera, ff, IE user, your designing a website for other people. Meaning you have to make sure the design is flawless all three browsers. Yeah it takes extra work to get it perfect, but after it's done oyu don't have to have to worry about making changes to the website while peopel are trying to access it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.