Download & Extend

Next button: Flicker problem and too many event handlers

Project:Lightbox2
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

There are two unrelated problems that I have noticed when using the next/prev buttons on a Lightbox modal:

1. When going from one image to another, the first image is hidden, then displayed again, and then replaced with the new image. This is caused by load()'s asynchronous behavior. This is fixed by using the load() callback.

2. Each time a previous or next button is pressed, a new click event handler is added, which results in the same event being called multiple times. This is fixed by unbinding click events before binding new click events (though that is not a great method of "solving" the problem since it precludes other scripts for adding click handlers).

Attached is a patch that fixes the first, and mitigates the second. Really, the second should be handled more gracefully.

I originally wrote these against the current release of 6-x--1-9, and then ported to head.

Matt

AttachmentSize
mpb-lightbox2.patch2.06 KB

Comments

#1

Attached is a slightly revised version of the patch that also works with lightvideo.

AttachmentSize
lightbox.js-revision1.patch 2.49 KB

#2

This worked perfectly. Thanks.

#3

I experienced the same behavior with the next/prev buttons (improperly posted here). This patch fixed it for me too. Thank you.

#4

Status:needs review» fixed

Committed, thanks!

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here