Trying to add javascript for display loading progress bar

Discuss the development and implementation of Joomla! 1.0.x templates here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
User avatar
fabs
Joomla! Explorer
Joomla! Explorer
Posts: 432
Joined: Mon Apr 03, 2006 4:04 pm
Location: Germany
Contact:

Trying to add javascript for display loading progress bar

Post by fabs » Tue Jan 30, 2007 8:20 am

Hi people!
I am trying to make a progress bar appear on my site as long as the page is loading, as i use some ajax lightbox stuff that does not work before page is fully loaded.

I tried with this script in my template index.php:

Code: Select all

TEMPLATE HEAD



<body style="background: #012f85;" onLoad="init()">

<div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;"><img src="images/loading.gif" border=0></div>
<script>
var ld=(document.all);

var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;

if (ns4)
	ld=document.loading;
else if (ns6)
	ld=document.getElementById("loading").style;
else if (ie4)
	ld=document.all.loading.style;

function init()
{
if(ns4){ld.visibility="hidden";}
else if (ns6||ie4) ld.display="none";
}
</script>



MY ACTUAL TEMPLATE BODY



</body>
</html>
Unfortunately the loading gif never stops loading although the page is finished.. Any idea why that is?
Does anybody have another solution at hand maybe?

Thx
Fabs
Please visit my personal website and leave many traces ;)
http://www.ffaabbiiaann.de
If you need webdesign services I can help you out:
http://www.webdesign2punkt0.de

kwak
Joomla! Ace
Joomla! Ace
Posts: 1055
Joined: Tue Nov 14, 2006 3:19 am
Location: Portland, OR USA

Re: Trying to add javascript for display loading progress bar

Post by kwak » Thu Feb 01, 2007 12:11 am

The only thing I can think of is to check the various "on*" event triggers to see if any of them fire when the page loading is complete.
Keith Watson

User avatar
fabs
Joomla! Explorer
Joomla! Explorer
Posts: 432
Joined: Mon Apr 03, 2006 4:04 pm
Location: Germany
Contact:

Re: Trying to add javascript for display loading progress bar

Post by fabs » Thu Feb 01, 2007 4:05 am

Thanks for trying to help me out here!

I copied the script from a live site and it was working perfectly fine there:
http://www.reconn.us/wait_demo.html

so how would i proceed to see where the error is... i did not change a thing in the script?!

thx
Fabs
Please visit my personal website and leave many traces ;)
http://www.ffaabbiiaann.de
If you need webdesign services I can help you out:
http://www.webdesign2punkt0.de

kwak
Joomla! Ace
Joomla! Ace
Posts: 1055
Joined: Tue Nov 14, 2006 3:19 am
Location: Portland, OR USA

Re: Trying to add javascript for display loading progress bar

Post by kwak » Fri Feb 02, 2007 3:12 am

Thank you for a live example.  Seeing it in action now I see what it is doing.  Your copy looks correct.  What browser is it not working in?

Have you done any Javascript programming or debugging before?
Keith Watson

User avatar
fabs
Joomla! Explorer
Joomla! Explorer
Posts: 432
Joined: Mon Apr 03, 2006 4:04 pm
Location: Germany
Contact:

Re: Trying to add javascript for display loading progress bar

Post by fabs » Fri Feb 02, 2007 11:16 am

NO programming or hardly. I just read some tutorials to basically get to  knwo javascript and understand how commands are structured and what means what more or less.... But apart from that I am just a copy&paste artist... that is why I am so lost...

The example site worked in FF but on my Site in FF it did not... the loading gif just never dissappeared on my site... i tried it on severeal of my pages  but no luck... might there be a conflict with other javascript on my site? How could i solve that?

Maybe somebody could review the javascript i already have to see whether it could produce and error or incompatiblility with the code above?

thanks so much kwak for helping!
fabs
Please visit my personal website and leave many traces ;)
http://www.ffaabbiiaann.de
If you need webdesign services I can help you out:
http://www.webdesign2punkt0.de

kwak
Joomla! Ace
Joomla! Ace
Posts: 1055
Joined: Tue Nov 14, 2006 3:19 am
Location: Portland, OR USA

Re: Trying to add javascript for display loading progress bar

Post by kwak » Sat Feb 03, 2007 5:03 am

I don't know how much I can really help on this.  Since it happens in FF (aka NS6) the Javascript is doing the right thing in specifically trying to hide the "loading" element.  But just because it "looks" correct doesn't mean something else is going on.  And I don't have experience with using a debugger to run a Javascript.  That would be something to look into.

Otherwise we'll have to wait until someone with some Javascript debugging experience sees this thread.
Keith Watson

qualityjoom
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Jun 07, 2012 11:59 am

Re: Trying to add javascript for display loading progress ba

Post by qualityjoom » Thu Jun 07, 2012 12:03 pm

Finally a code I can use, It works perfectly....at first it messed with my background so I removed style="background: #012f85;"

Here's a look at it, http://www.qualitylist.org/web-designers

My site loads a bit slow due to google adsense so your code came in handy!
I just added it to my index php and created an image, that simple!

Next is, I don't want it on every page of my site so I'll have to see where I can place it on a specific module :pop


Locked

Return to “Templates & CSS - 1.0.x”