Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var $pswp2 = $('.pswp')[0];
- $('.gallery-section').each(function() {
- var $pic2 = $(this),
- getItems2 = function() {
- var items2 = [];
- $pic2.find('a.gallery-popup').each(function() {
- var $href2 = $(this).attr('href'),
- $size2 = $(this).data('size').split('x'),
- $width2 = $size2[0],
- $height2 = $size2[1];
- var item2 = {
- src : $href2,
- w : $width2,
- h : $height2
- };
- items2.push(item2);
- });
- return items2;
- };
- var items2 = getItems2();
- $pic2.find('a.gallery-popup').click( function(event) {
- event.preventDefault();
- var $index2 = $(this).data('index');
- var options2 = {
- index: $index2,
- bgOpacity: 0.7,
- showHideOpacity: true
- };
- // Initialize PhotoSwipe
- var lightBox2 = new PhotoSwipe($pswp2, PhotoSwipeUI_Default, items2, options2);
- lightBox2.init();
- });
- });
- </script>
- <div class="gallery-section">
- <?php
- $galleries = get_field('gallery_images');
- $imgfirst = wp_get_attachment_image_src( $galleries['images'][0], 'full' );
- $full_image_sizes = $imgfirst[1].'x'.$imgfirst[2];
- ?>
- <a href="<?php echo $imgfirst[0]; ?>" data-src="<?php echo $imgfirst[0]; ?>" data-size="<?php echo $full_image_sizes; ?>" data-index="0" class="gallery-popup">
- <img class="full-gallery" src="<?php echo $imgfirst[0] ?>">
- </a>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement