Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ADD MAGNIFIC POPUP TO IMAGE LINKS AND GALLERIES
- $(document).ready(function() {
- //does the image have a parent element with a gallery class?
- if ( $('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').parents('.gallery').length == 1 ) {
- //if yes, then is must be a gallery image and we should enable the gallery feature
- $('.gallery').magnificPopup({
- delegate: 'a',
- type: 'image',
- gallery: {
- enabled: true
- }
- });
- } else {
- //if no, then it must be a single image and should have a popup added to it
- $('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').magnificPopup({type:'image'});
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement