Magnific Popup is a free responsive jQuery lightbox plugin that is focused on performance and providing best experience for user with any device (Zepto.js compatible).
What makes this plugin different?
Light and modular
You can choose to include only the features that you need using the online build tool or by compiling it yourself with Grunt.js. Size of core JS file is about 3KB + each module weights about 0.5KB (gzipped). Sass CSS preprocessor is used for easier skinning, but you're not obligated to use it.
Content is resized with CSS
The majority of lightbox plugins require you to define size of it via JS option. Magnific Popup does not - feel free to use relative units like EM's or resize lightbox with help of CSS media queries. Update content inside lightbox without worrying about how it'll resize and center.
High-DPI (Retina) display support
Default controls are made with pure CSS, without external graphics. For the main image there is a built in way to provide appropriate source for different pixel density displays.
Plugin has an option to automatically switch to alternative mobile-friendly source on small screen size. Brad Frost has a terrific article about this technique.
Popup has an extendable micro templating engine that reuses existing DOM elements (example), which is expecially useful when your popups same pattern.
Single image lightbox
Three simple popups with different scaling settings. First one fits in area horizontally and vertically, second one - only horizontally, third one - has no gaps and close button is always in top right corner.
You may put any HTML content in each gallery item and mix content types (example). In this example lazy-loading of images is enabled only for the next item based on move direction.
Popup with video or map
In this example lightboxes are automatically disabled on small screen size and default behavior of link is triggered.
Dialog with CSS animation
Animations are added with simple CSS transitions, you can make them look however you wish.
Popup with form
Entered data is not lost if you open and close the popup or if you go to another page and then press back browser button.
You have full control of what is displayed in popup, align it to any side via CSS, enable or disable scroll on right side of window - whatever.
Tested on desktop: Chrome, Safari, FF, Opera, IE8+, partial support of IE7 (works, but some visual layout features, like vertical centering, are missing). Mobile: default browser in Android 2.3+, iOS5+, Blackberry 10+, WP7+, mobile Opera and Chrome on Android. If you noticed any bug, please open an issue on GitHub
Script is available under MIT license and will always be kept this way.
But please do me a favor and do not create a public WordPress plugin based on it, because I will make it soon and it will be open souce too (want to get notified?).
Bugs & contributing
Special thanks to:
- Lokesh Dhakar for original Lightbox script.
- Chris Coyier for awesome CSS techniques.
- Brad Frost for conditional lightbox technique.
If you wish to get notified about important plugin updates, you may star and watch the repository on GitHub, follow me on Twitter, or join my tiny Mailchimp email newsletter that I send 3-4 times a year.