![]() |
Javascript Conflict, Scrollbar and Lightbox
Hi,
I'm just putting the finishing touches on my new website and decided to include a custom scroll bar to really finish off the look of a couple of pages. I've managed to implement it successfully into one of my pages, however on another it seems to be a bit hit and miss as to whether it works in different browsers. After some experimentation I think I've managed to determine that the problem is that the javascript for the custom scrollbar is conflicting with some other javascript on the same page (lightbox image viewer). I came to this conclusion as prior to adding the custom scrollbar lightbox worked fine, and now after adding the addition javascript for the scrollbar lightbox has stopped working (and the scrollbar is hit and miss as to whether it works). In addition as I say, I have implemented the scrollbar into a different page (which doesn't have any other javascript to conflict with) which seems to work fine. Here's the page prior to adding the new scrollbar and with lightbox working: Here's the page with the scrollbar added and lightbox not working: The code that I suspect is conflicting is as follows: Code:
Anyone have any idea of how I might fix this? (PS. I am still a bit of a noob when it comes to code, so please make any suggestions as simple as possible!) Thanks |
If you try using the search feature of this forum, you will find that this is quite a common problem. Using two different Javascript frameworks (jQuery and prototype) very often causes conflicts which unfortunately cannot be resolved. Remedy - use only one framework.
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit. |
So there's absolutely NO way around it? It's one or the other?
|
See post #2.
|
Fixed, with both working
http://www.ryanrobinsonguitarist.co.uk/gear.html To anyone else having the same issue of trying to use Lightbox with other Javascript, use Slimbox instead. |
Your statement is misleading. It sounds like you fixed it with using both, jQuery and prototype, but actually you just exchanged the prototype based overlay script with a jQuery based script, so that you just use jQuery. There is a jQuery lightbox plugin, by the way.
Generally you can say that there is a jQuery plugin for everything you find on the internet. So whenever you find something that’s not jQuery and would cause conflicts, just search for a jQuery plugin using the same terms. |
Quote:
I just wanted to show to anyone else that might come across this thread having the same problem that here IS a solution to having both elements. The original replies to the post left me feeling discouraged and that it was totally impossible to achieve, so I was just glad to proclaim that I had managed it! |
| All times are GMT +1. The time now is 02:11 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.