Log in

View Full Version : Looking for a banner rotator for my site



nattie
07-06-2011, 05:10 PM
I am looking for a banner rotator that will display ads on my site. I am trying to find something that will automatically rotate itself every 5 seconds or so WITHOUT refreshing the page.

I have already tried the rotator from this site: http://www.htmlbasix.com/banner.shtml
But it seems to delay for me so I don't really like using it.

So if anyone knows a good code that would be really helpful, thank you!

djr33
07-06-2011, 07:17 PM
Do you want it to load something new, or do you want it to preload all of the content and rotate through it?

Do you want it to be an HTML banner, or just an image?

Those two questions are very important:

HTML and preload:
Easy. You will load several divs when the page initially loads. Then set their CSS display property to "none" so they are hidden. Then use Javascript to rotate through them.

HTML and load new content:
Hard. You will need to use Ajax to replace the contents of the div. Google "Ajax" or look at some of the scripts available here on DD for it (under "dynamic content").

Image and preload:
Hard. You will need to look at an image preloading script. Then rotate through them using JS.
Easier. Or you can do the same as HTML and hide the images (although I think display:none; may actually not load the images).

Image and load each time:
Easy. You will use a single <img> tag as the banner and change the SRC using Javascript in a loop every five seconds. That will make the new image load. It's like a rollover/mouseover script, but based on a loop rather than user interaction. Note that for this (and probably the others) it's best if the banner is always the same size.


Of course even the "hard" ones will not be so difficult if you use existing scripts for the hard parts, such as Ajax.


Decide which approach is best and if you need more help let us know.

nattie
07-06-2011, 10:35 PM
Hi, the banners are just image files. I was just looking for something that will rotate through them all.

Sorry if I didn't explain clearly enough--I don't know much about scripts.

Nile
07-06-2011, 11:23 PM
I think this should do it for you: http://www.dynamicdrive.com/dynamicindex14/flexislide.htm

If that doesn't work out for you, I can make an even simpler banner rotator for you.

nattie
07-06-2011, 11:56 PM
Yes this one seems like it's exactly what I'm looking for! I'll give it a try. But does this one allow links so when I click on it, it will lead to another site?

And just curious, what do you mean a simpler rotator? :)

Nile
07-07-2011, 12:07 AM
You can use links in this.

By simpler I meant easier to understand and look at, but if this works fine, by all means use this one.

nattie
07-07-2011, 12:21 AM
Oh well I don't have much experience with this stuff so could you show me the simpler rotator? Will this cost money or anything?

Nile
07-07-2011, 01:12 AM
No, but give the one I linked to a try first

nattie
07-07-2011, 01:27 AM
I did and it works for the most part..except it only allows 3 banners and I need more than that and it also says "undefined" under it and I'm not sure why it's doing that.

Nile
07-07-2011, 02:28 AM
It allows more, you just have to add more to the array:


variableslide[0]=['ball.gif', '', '']
variableslide[1]=['spaceship.gif', 'http://www.space.com', 'Has aliens landed on earth? You decide.']
variableslide[2]=['cake.gif', '', '']
variableslide[3] = ['','','']
variableslide[4] = ['','','']

nattie
07-07-2011, 02:42 AM
Oh okay, thanks! But do you happen to know why it says "undefined" under it? I've been trying to fix it but I can't find the problem.

nattie
07-07-2011, 03:37 AM
Oh, never mind. I figured it out myself! Thank you so much for the help, Nile. I really appreciate it!

Nile
07-07-2011, 03:44 AM
I assume it says undefined because you're missing something in your array:


variableslide[0] = ["image.png", "", ""];


But I don't know, does everything work perfectly now?