lightbox-0.5 jquery 兼容性问题

发布于 2024-12-17 12:38:10 字数 557 浏览 1 评论 0原文

我正在尝试从这里集成 jquery lightbox 插件: http://leandrovieira.com/projects/jquery/ lightbox/

它可以工作,但仅适用于 jquery 1.2.3

当灯箱关闭并第二次启动时,即下一个和上一个链接无法正确循环浏览照片时,

如果我单击下一个链接,照片的顺序开始跳跃,而不是点击一张一张地浏览照片,它会变成 1、3、5 等等

,顺便说一下,只有当我尝试使用键盘箭头导航时,如果我使用鼠标然后它就可以了,但只有键盘

很奇怪,因为我试图解压缩原始提供的示例文件,我只是将 jquery 版本替换为较新的版本,那就是当我发现这个问题时,

我所做的就是将 jquery 版本从1.2.3 至任何较新版本一,这是问题开始的时候

我尝试在 Internet Explorer、Firefox、Chrome、Safari 甚至不同的计算机上运行相同的 html,但仍然是同样的问题

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红衣飘飘貌似仙 2024-12-24 12:38:10

您可以在网络上发布问题页面的链接吗?

另外,您可以尝试将 Lightbox 替换为 Slimbox2 - 它具有几乎相同的 UI,但可以彻底解决错误。

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.

沧桑㈠ 2024-12-24 12:38:10

我这样解决了问题:在方法 _set_image_to_view() 中,在行之间添加行 _disable_keyboard_navigation();
_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);

objImagePreloader.onload=function(){};

因此整个方法如下:

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

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];
    };
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文