Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Self.photoswipe = function(){
- var $pswp = $('.pswp')[0];
- $('.gallery-lists').each(function() {
- var $pic = $(this),
- getItems = function() {
- var items = [];
- $pic.find('.gallery-item:not(.isotope-hidden):not(.slick-cloned) a.photoswipe-link').each(function() {
- var $href = $(this).attr('href'),
- $size = $(this).data('size').split('x'),
- $width = $size[0],
- $height = $size[1];
- var item = {
- src : $href,
- w : $width,
- h : $height
- };
- items.push(item);
- });
- return items;
- };
- $pic.find('a.photoswipe-link').click( function(event) {
- event.preventDefault();
- var items = getItems();
- var slick = $('.gallery-element').data('slick');
- var $index = $(this).data('index'),
- $items = $pic.find('.gallery-item:not(.isotope-hidden):not(.slick-cloned)'),
- parent = $(this).closest('.gallery-item'),
- index = $items.index(parent);
- var options = {
- index: index,
- bgOpacity: 0.7,
- showHideOpacity: true
- };
- // Initialize PhotoSwipe
- var lightBox = new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options);
- lightBox.init();
- });
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement