...

View Full Version : Limit the CSS divs while loading?



nickbunyun
10-27-2010, 06:07 PM
Hi all,

A friend asked me to help with the banner.
It is using BXSlider, and all banner slides are <ul>

http://1.gwinnettehc.net/index.php

If you refresh the website a few times, you will notice that on the first page, the banner loads all slides, pushing the website down by like 1500px, and than it loads it restricts it.

I'm trying to get rid of that loading part where it pushes the website down, basically where it loads all banner slides at once.

Can i do that with CSS? can I automatically limit the banner div?
It looks bad when it does that :(

Help!

santhoshj400
10-30-2010, 11:40 AM
Hi,
use javascript and jquerry to limit the size of div at the time of loading using onload function

nickbunyun
10-30-2010, 05:44 PM
Hi,
use javascript and jquerry to limit the size of div at the time of loading using onload function

Hi,

Thank you for your reply. If that will work, it'd be perfect.

Can I ask how to add that?

I've tried searching for some jq onload examples, but i can find anything that can help me figure out to make the div a fixed height...

could you help me with the code please?

thank you

chuffman
10-30-2010, 05:55 PM
could you help me with the code please?

thank you

Place This In The <head></head>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//#divID is your ad div's ID, 100 is the height of the div
$("#divID").css("height", "100");
});
</script>

Place (or edit current div) where your ad's div is, we just need the div to have an id that matches the one up there.

<div id="divID">This is your ad's div!</div>

nickbunyun
10-30-2010, 06:25 PM
Hey chuffman, thank you for the reply.

I have added that code, replaced the div id, i added a div around the whole banner called it
"bannerlimit"

it still loads all the ul slides, than it puts it in format.

I have added your code above all other scripts, still nothing.

does it need to have something along the lines of "on load" ?


EDIT:
I added a "overflow:hidden" and now it loads just fine.
only works thru the JQ tho..
Thanks so much guys, God bless!

chuffman
10-30-2010, 07:18 PM
Hey chuffman, thank you for the reply.

I have added that code, replaced the div id, i added a div around the whole banner called it
"bannerlimit"

it still loads all the ul slides, than it puts it in format.

I have added your code above all other scripts, still nothing.

does it need to have something along the lines of "on load" ?


EDIT:
I added a "overflow:hidden" and now it loads just fine.
only works thru the JQ tho..
Thanks so much guys, God bless!

the $(document).ready() is jQuery's onLoad. If the user can't user jQuery than they can't use Javascript either so OnLoad won't matter.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum