PDA

View Full Version : Lightbox image viewer 2.03



drmeisner
10-25-2007, 04:59 PM
1) Script Title: Lightbox image viewer 2.03

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm
3) Describe problem:

I am running this script on two different sites: http://ewcs.ca/gallery/index.html and http://www.copycatdigital.ca/gallery/index.html

On the first site, I have three different groups set up, and all works fine. You can click from one image to the next without any problem. On the second site, when you click an image, it shows up, then you can click Prev or Next and the next or previous image shows up. If you click Next or Prev again, the image called for never loads, and I see a Javascript error icon in the status bar of my browser. (Both IE6 and Firefox) If you refresh the browser and attempt to load the one that did not load before, it loads, and then the same problem occurs again as mentioned above. All the images are on the server in the correct place.
Any ideas what the problem may be?
Thanks!
drmeisner

jscheuer1
10-25-2007, 08:35 PM
This is a little complicated. Lightbox has a function named pause in its lightbox.js file. Another script used on the page with the problem:

scroller.js

has a variable named pause. It is a number. Since the scroller.js script gets parsed after the lightbox.js script, lightbox's function pause is being overwritten by scroller's variable pause. What you can do is open either script in a text only editor and change every instance of the word 'pause' to - say:

pause_2

Only do this to one of the two scripts. That will take care of that, there could be other problems.

drmeisner
10-25-2007, 09:55 PM
Hi John, thanks for the advice. I tried changing the pause variable in scroller.js to pause_2 as suggested. I then reloaded the page and I still had the same result. I undid all those changes to scroller.js and did the same thing to lightbox.js. I reloaded the page and still no go. I am using Dreamweaver as my javascript editor. Would it be better to use notepad or something else to ensure the files edit correctly, and then use CuteFTP to upload in ASCII mode? Any other ideas you may have would be welcome.

Thanks,
drmeisner

PS: As an afterthought, I used the editor that is part of cpanel at my webhost to edit the scroller.js file again. I still had the same results though, so I put both files back the way they were.... Also, I remembered I am using the scroller.js and the lightbox.js files on the same page at the same time on the other site http://ewcs.ca/gallery/index.html without any issues.

jscheuer1
10-25-2007, 11:46 PM
Sorry to have to say this, but you are wrong. The scroller.js script (at least not the exact one from the non-working page) is not on the working page.

Just as a test, without altering anything, you can paste this into the address bar of each page and hit enter:

javascript:alert(pause)

You will see that each page gives a different result.

You may have made an error in editing the file (notepad is a better choice of editor for this task than is DW), or you may not have uploaded the altered file to the correct location. Or, you may have done everything right, but there is either another problem as well or you simply were loading an old cached version of the script. Make the change again to one of the scripts, and leave the altered one in place. Clear your cache, and view the page again.

If the problem persists, tell me which script you changed, and give me a chance to look over the page again.

drmeisner
10-25-2007, 11:58 PM
Hi John, you were right. I suspect the problem was that the scroller.js did not get refreshed properly on the server, although I don't know why. I did it first in Dreamweaver, and it didn't work so I undid it, then I did it online using cpanel, and it didn't work, so I undid that. After receiving your last post, I opened the file in Dreamweaver from the server, and overwrote my local copy, made the same 3 changes using find and replace like before and saved it to the server. I then refreshed the page and it worked. I can't explain what happened.... Oh well, thanks to your keen eyes the problem is solved!

Thanks for everything,
drmeisner

Funny thing. It works on my desktop, but not my laptop. I cleared my cache on the laptop. Both running IE7 and Windows Vista. Also, on the desktop, it works in Firefox and Flock, but not Opera.

jscheuer1
10-26-2007, 03:37 AM
Clearing out a cached external javascript file is not always as easy as refreshing the page. The entire browser cache may have to be emptied. If you have any kind of 'web accelerator' utilities, these may be preserving, and/or replacing the cached script (on the local machine) beyond what would normally be done.

Vista, which I have no direct experience with, may be doing something strangely. If the original 'working' page is OK under it, the problem (if attributable to Vista) should be easy to fix if it can be found. In any case, the script has been updated. On a browser with a clean cache, the pause function is now as it should be for lightbox. The page tests out and performs well under Opera, IE 7, FF, and Safari Win here.

You may just need to give it some time, reboot, clear the cache again, whatever, to see the change take effect. If the problem persists beyond that -

Try the:

javascript:alert(pause)

test on the system and browser that is still giving you trouble and let me know what you find.

drmeisner
10-26-2007, 10:44 PM
Hi John,

It would seem that the problem exists on some Vista Machines. I tried all five machines at work today. They are running XP Pro. The script worked fine in IE6, Firefox, Flock, Opera, and Netscape. At home we have three machines with Vista and IE7. Two of the machines are desktops, and one is a laptop. The 2 desktops work OK, but the laptop still gives the original error, even though I cleared the cache and rebooted. The laptop does have the Google Web Accelerator on it, I disabled it but it did not help. Weird...
Thanks again,
Dwayne

jscheuer1
10-26-2007, 10:59 PM
That all being the case, it isn't exclusively a Vista issue, though Vista may, or may not be playing a role in this. More likely, the laptop is simply unable to run the script due to its settings. These may be settings of the OS, browser, firewall, or anti-virus/anti-malware software - or something else. If the laptop is OK in say, FF - then it is most likely the IE 7, or the IE 7 specific to Vista settings on that particular machine.

You really should perform the:

javascript:alert(pause)

test on that machine and browser to see what result you get. Report back - that is if you still want to find a resolution for this and haven't yet.

If you do find the answer, I would love to know what the solution is in this particular case, as one never knows when something similar might come up again.

drmeisner
10-28-2007, 02:42 PM
Hi John,

On the laptop I ran the javascript:alert(pause) test and got the error in the staus bar. I went to the Tools> Internet Options> Security window in IE7 and reset all zones to the default level. I then reloaded the gallery page and it worked! I suspect that because I have used the laptop to connect to other wireless networks besides our own, that some setting was automatically set. I normally use the default settings on all the machines, both at home and work. I don't know why the laptop was different. In any event, the thing is now working!

Thanks for all your help.
Dwayne