4

I am trying to integrate the jquery lightbox plugin from here: http://leandrovieira.com/projects/jquery/lightbox/

It is working but only with jquery 1.2.3

When the lightbox is closed and launched the second time, that is when the next and previous links don't cycle through photos properly,

If i click on the next link, the order of photos start to jump like instead of going through photos one by one on click it goes 1, 3, 5 and so on

by the way, this problem happens only when i try to navigate with keyboard arrows, if i use mouse then its fine, but only with keyboard

strange, because i tried to unzip the original provided sample files and I just replaced the jquery version to the newer one and that is when i discovered this problem,

all I did is changed the jquery version from 1.2.3 to any newer one and this is when the problem started

I tried to run the same html in internet explorer, firefox, chrome, safari and even on different computers, but still the same problem

2
  • Are you using Firebug or another debugging tool? Do you get errors in the console that would indicate where the problem is? Commented Nov 24, 2011 at 17:54
  • no errors in firebug, this problem only starts when I change the jquery reference to any newer version of jquery, the problem is that it skips through some images on keyboard arrows press and it starts happening only when I launch the lightbox for the second time (first time it works fine) Commented Nov 24, 2011 at 19:39

2 Answers 2

2

Can you post a link to the problem page on the web?

Also, you could try swapping Lightbox for Slimbox2 - it has a nearly identical UI, but may solve the error outright.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Wade, what I noticed in my lightbox which I tried to use is that, if you try to cycle through the mouse click arrows (next and previous arrows) in this case the images cycle normally, the problem only starts once the keyboard arrows are pressed, so the way I solved it was, I simply forced click event once the keyboard are pressed using jquery case, I know its not the best way to solve that problem, but I think its fine for a temporary solution as it works
1

I solved the problem this way: in the method _set_image_to_view() add the line _disable_keyboard_navigation(); between lines _resize_container_image_box(objImagePreloader.width,objImagePreloader.height);

and

objImagePreloader.onload=function(){};

Thus the entire method is as follows:

function _set_image_to_view() { // show the loading // Show the loading $('#lightbox-loading').show(); if ( settings.fixedNavigation ) { $('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); } else { // Hide some elements $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); } // Image preload process var objImagePreloader = new Image(); objImagePreloader.onload = function() { $('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]); // Perfomance an effect in the image container resizing it _resize_container_image_box(objImagePreloader.width,objImagePreloader.height); // for reducing problem with navigation using keyboard (switching some pic at one time) _disable_keyboard_navigation(); // clear onLoad, IE behaves irratically with animated gifs otherwise objImagePreloader.onload=function(){}; }; objImagePreloader.src = settings.imageArray[settings.activeImage][0]; }; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.