PDA

View Full Version : Floating Top Bar script - More than one instance on a page?



repspecials
12-19-2012, 12:53 PM
Hi guys, I've been messing around with this floating top bar script and I've been trying my best to configure it so that I can have two sidebars, one on the left and one on the right. The idea is they will house links that scroll down with the page as the user works their way down. The trouble is, even with changing a lot of the coding it doesn't seem to like running concurrently. Is there a way I can have two instances of this script working on one page or am I just bashing my head against a wall here. Thank you in advance guys. Oh and DD, smashing site big thanks for the great scripts as always.

traq
12-19-2012, 03:05 PM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

repspecials
12-19-2012, 03:28 PM
Sorry here is the thread...

http://www.dynamicdrive.com/dynamicindex17/floatbar.htm

Thanks guys

traq
12-19-2012, 04:08 PM
This particular script wasn't designed to have more than one instance on a page: all of its references to the "topbar" are hardcoded. You could create a second copy of the script, changing all of the references to topbar to topbar2 (or, whatever), but that's really not a solution.

I'm interested, though. When I get home I'll see how difficult it would be to rewrite this to accept arbitrary element ID's. I don't think it would be particularly difficult.

---------------
If you want help with your attempt, you'll need to share the code you've been working with.

repspecials
12-19-2012, 09:55 PM
Thanks very much for your help but in the meantime I have just found it far easier to use css and a fixed positional attribute to create the side bars I needed. It actually runs a lot smoother than the javascript version as well. I did try completely re-writing the code so that none of it conflicted but to no avail, for some reason it was still preventing one of the bars from scrolling. Oh well, all is well that ends well, thank you very much for your kind offer of help though it was much appreciated.

Merry Christmas all