PDA

View Full Version : Random Content Order script



Orlando Dude
09-13-2006, 04:48 PM
1) Script Title: Random Content Order script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/randomcontentorder.htm

3) Describe problem: Trying to randomise banner advert graphics with different coloured backgrounds using different styles. Different style color for a category.

Script works fine but if I have -
<script type="text/javascript">

//randomize order of contents with DIV class="group1"
randomizeContent("group1")
randomizeContent("group2")

</script>

group 1 and group 2 randomise separately.

Can I get them all to randomise together.

Tried -
<div class="group1 group2">

This works but randomises the content not the whole <div> .Advert graphics goin the wrong color <div>.

Thanks

ddadmin
09-13-2006, 06:49 PM
Hmm I'm not sure I understand. Whether group 1 and group 2 randomise separately or "together", the end result is that the two groups are randomized. If you're talking about giving both group 1 and group 2 a common style, you can do that by giving both groups an extra, shared class, like:


<div class="group1 sharedstyle">
</div>

<div class="group2 sharedstyle">
</div>

jscheuer1
09-13-2006, 07:02 PM
The way to get all of the items to randomize together would be to give them all the same group class - say, group1. If you need to have different classes for the background colors within group1, the divisions in group1 can have additional classes for their background colors:


<style type="text/css">
.group1 {
visibility: hidden;
}
.c1 {
background-color:red;
}
.c2 {
background-color:green;
}
</style>


<div class="group1 c1">

for items in group1 that also have color styling defined by the class selector "c1" and:


<div class="group1 c2">

for items in group1 that also have color styling defined by the class selector "c2".

Orlando Dude
09-14-2006, 03:33 PM
Thanks.

Kinda makes sense (I think).

I'll give it a go and report back.

Thanks again.

Orlando Dude
09-15-2006, 02:48 PM
I put the sytles in an external .css - would that make a diference?

Test page -
http://orlando-maps.info/_advertisers/orlando_maps_advertisers.htm

Tickets Companies are supposed to be in red boxes and red boxes shoulkd shuffle with grey boxes (if possible)

thanks

Orlando Dude
09-15-2006, 03:23 PM
OK think I get it now...

To do what I want would require applying the Style to the Image.

This is not possible I believe???

Ta

Orlando Dude
09-15-2006, 03:29 PM
Thought I had it for a moment...

Figured how to put a Style to an Image but now an image can't have a background - brat.

Is there any way to nest <div>'s?

Orlando Dude
09-15-2006, 03:58 PM
Got it...

Nested a <div> in the <div>.

http://www.orlando-maps.info/_advertisers/orlando_maps_advertisers.htm

Just wonder if it can be simplified?

Thanks