Skip to content

Releases: lokesh/lightbox2

v2.12.0

28 Feb 05:30
fc01875

Choose a tag to compare

What's Changed

Full Changelog: v2.11.5...v2.12.0

Bug fixes

  • Fix resize handler memory leak β€” $.proxy reference mismatch caused listeners to accumulate on every open/close cycle
  • Fix .lb-prevLink/.lb-nextLink dead selectors in sizeContainer() β†’ corrected to .lb-prev/.lb-next
  • Add preloader.onerror handler β€” broken images no longer leave the lightbox stuck in loading state
  • Fix SVG file type detection for URLs with query strings (image.svg?v=2) or fragments
  • Cancel pending image loads on rapid navigation β€” prevents race conditions causing layout glitches
  • Fix this/self inconsistency in contextmenu handler

Accessibility

  • Add role="dialog", aria-modal="true", aria-label="Image lightbox" to #lightbox
  • Implement focus trap β€” Tab is constrained to lightbox elements while open
  • Restore focus to the trigger element on close
  • Add aria-describedby linking the displayed image to its caption
  • Add aria-live="polite" to image counter so screen readers announce navigation
  • Remove empty href="" from nav buttons (already have role="button" + tabindex="0")

New public API

  • lightbox.open(images, startIndex) β€” open programmatically with a URL string or array of {link, title, alt} objects
  • lightbox.close() β€” close programmatically
  • lightbox.next() / lightbox.prev() β€” navigate programmatically
  • lightbox.destroy() β€” remove DOM elements and unbind all event listeners

New events

  • lightbox:open, lightbox:close, lightbox:change triggered on $(document) with album and index data

CSS

  • Switch overlay and lightbox from position: absolute to position: fixed β€” eliminates JS-based overlay sizing
  • Add 11 CSS custom properties for theming (colors, border radius, transition speeds) on :root
  • Remove stale -webkit-, -moz-, -o- vendor prefixes from transitions

Code quality

  • Replace void 0 with undefined, i = ++i with i++
  • Cache 7 additional jQuery element references in build() β€” eliminates repeated .find() calls
  • Fix selector injection in album grouping β€” use .filter() instead of string-concatenated selectors
  • Replace return false with event.preventDefault() on nav buttons
  • Use self consistently instead of mixing self/.bind()

Build tooling

  • Replace Bower with npm for jQuery dependency
  • Replace JSHint + JSCS with ESLint (flat config, v10)
  • Replace Grunt with npm scripts (npm run build, npm test)
  • Remove bower.json, Gruntfile.js, .jshintrc, .jscsrc
  • No global installs required β€” just npm install

v2.11.5

03 Oct 18:15
de06988

Choose a tag to compare

  • fix: Remove IE6,7 specific css rules: zoom and filter by @lokesh in #755
  • docs: fix spelling by @lokesh in #756

v2.11.4

21 Feb 22:36
efaf39f

Choose a tag to compare

  • added href to .lb-cancel fix #714
  • Accessibility issues (WCAG compliance) #708
  • Current release uses outdated JQuery #707
  • Horizontal white space of lightbox-container with SVG images #706

v2.11.3

11 Jul 03:24

Choose a tag to compare

  • #684 feat: When displaying SVGs, max out their size

v2.11.2

07 Jul 05:03

Choose a tag to compare

Same as v2.11.1 release

v2.11.1

14 Jul 02:24

Choose a tag to compare

  • #557 Bugfix - MaxHeight wouldn't work. Fix by @RuiBandarra
  • #660 fix: use max[Width|Height] when fitImagesInViewport is false. Fix by @k-iwanishi
  • #664 feature: Prevent Esc keypress from bubbling. Requested by @rkyoku in #663

v2.11.0

22 Apr 04:37
500e07e

Choose a tag to compare

  • #552 SVGs without width and height attrs incorrectly sized in IE11 and older Firefox. PR: #649
  • #621 Remove alpha kbd aliases for closing and nav (x/c/o/n/p). Keep ESC and arrows. 9ea5e60
  • #620 Disable Scrolling scrolls to top when image is clicked. PR: #650
  • Adds empty alt text for placeholder image. PR: #634 by @Nhawdge
  • Add aria-labels to prev and next images. Problem and fix by @elohanlon PR: #651
  • #520 Toggling visibility of elements on open/close revealing intentionally hidden elements. PR: #652
  • #635 Caption links handlers doesn't trigger. PR: #653
  • Fixed images size when changing positionFromTop. Fix by @martijndebruijn PR: #654

v2.10.0

26 Nov 21:09

Choose a tag to compare

  • [Fix] disable scrolling option not working on iOS #611
  • [Fix] Remove image files from bower json main prop #613
  • [Fix] Prevent dupe lightbox DOM elements from being created on multiple calls of lighbox.init() #615
  • [Change] Update bower.json's jquery dep requirement from ~2 to 2> #614
  • [Change] Remove image preloading in css. Not req. #612

v2.9.0

30 Oct 18:48

Choose a tag to compare

  • [Fix] Allow loading of lightbox.js anywhere on page. Prev requirement was at the end of the body tag. Commit
  • [Add] Add imageFadeDuration option. Commit
  • [Change] Right-clicking image now shows context menu for image. Commit
  • [Change] Allow controlling of image border with a simpler css border vs a parent container padding hack. Commit

v2.8.2

14 Dec 05:21

Choose a tag to compare

  • [Add] npm support. npm install --save lightbox2
  • [Add] Add option to disable vertical scrolling #487 Thanks blacksunshineCoding
  • [Fix] When horizontal scrolling is on page the overlay is not covering entire page #485 Thanks @manuel-io
  • [Change] Add css minify task to Gruntfile.js and removedlegacy css vendor prefixes for border-radius. #470 Thanks ajerez