Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2013
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //ADD MAGNIFIC POPUP TO IMAGE LINKS AND GALLERIES
  2.         $(document).ready(function() {
  3.             //does the image have a parent element with a gallery class?
  4.             if ( $('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').parents('.gallery').length == 1 ) {
  5.                 //if yes, then is must be a gallery image and we should enable the gallery feature
  6.                 $('.gallery').magnificPopup({
  7.                     delegate: 'a',
  8.                     type: 'image',
  9.                     gallery: {
  10.                         enabled: true
  11.                     }
  12.                 });
  13.             } else {
  14.                 //if no, then it must be a single image and should have a popup added to it
  15.                 $('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').magnificPopup({type:'image'});
  16.             }
  17.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement