Releases: lokesh/lightbox2
Releases Β· lokesh/lightbox2
v2.12.0
What's Changed
Full Changelog: v2.11.5...v2.12.0
Bug fixes
- Fix resize handler memory leak β
$.proxyreference mismatch caused listeners to accumulate on every open/close cycle - Fix
.lb-prevLink/.lb-nextLinkdead selectors insizeContainer()β corrected to.lb-prev/.lb-next - Add
preloader.onerrorhandler β 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/selfinconsistency 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-describedbylinking 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 haverole="button"+tabindex="0")
New public API
lightbox.open(images, startIndex)β open programmatically with a URL string or array of{link, title, alt}objectslightbox.close()β close programmaticallylightbox.next()/lightbox.prev()β navigate programmaticallylightbox.destroy()β remove DOM elements and unbind all event listeners
New events
lightbox:open,lightbox:close,lightbox:changetriggered on$(document)with album and index data
CSS
- Switch overlay and lightbox from
position: absolutetoposition: 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 0withundefined,i = ++iwithi++ - 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 falsewithevent.preventDefault()on nav buttons - Use
selfconsistently instead of mixingself/.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
v2.11.4
v2.11.3
v2.11.2
v2.11.1
v2.11.0
- #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
- [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
~2to2>#614 - [Change] Remove image preloading in css. Not req. #612
v2.9.0
- [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
- [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