JQuery-lightbox-0.5 compatibility issue

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

It works, but only with jquery 1.2.3

When the lightbox is closed and launched a second time, that is, when the next and previous links will not view photos correctly,

If I click on the following link, the order of the photos will start jumping, and instead of viewing the photos one by one, press 1, 3, 5, etc.

By the way, this problem only occurs when I try to navigate using the keyboard arrows, if I use a mouse, then it’s fine, but only with the keyboard

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

all i did was change the jquery version from 1.2.3 to any new 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

+4
source share
2 answers

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

In addition, you can try replacing Lightbox with Slimbox2 - it has an almost identical user interface, but can solve the error problem.

+2
source

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

and

objImagePreloader.onload=function(){};

So the whole method looks like this:

 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]; }; 
0
source

Source: https://habr.com/ru/post/1382569/


All Articles