• Hello! I am making my first WordPress site from scratch (My own theme files etc.) and I’m currently working on implementing masonry with infinite slider, I have done everything I think i should need to have done but can’t seem to get it working – if someone could help it’d be greatly appreciated.

    Heres the page of the site – https://vn.deckchairdesign.co.uk/wedding/weddings/

    My CSS Selectors –

    Content Selector: .masonry

    Navigation Selector: #menu-primary

    Next Selector: .menu li

    Item Selector: .item

    If you need any other information I’ll be happy to give it to you, Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Harryadf

    (@harryadf)

    Thought my template code might be useful too, thanks again!

    <script>
    
    				$(window).load(function() {
    				    var $container = $('.masonry');
    
    				    $container.imagesLoaded(function(){
    				      $container.masonry({
    				        itemSelector: '.item',
    				          });
    						});
    					});
    					</script>
    
    	<div class="masonry">
    
    			<?php if(get_field('images')): ?>
    				<?php $size = "thumbnail";?>
    				<?php while(the_repeater_field('images')): ?>
    						<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
    						<?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail'); ?>
    
    						<div class="item">
    
    							<!-- Lightbox Image's -->
    							<a>" class="fancybox" rel="gallery_group">
    							<!-- Thumbnail Image's -->
    							<img src="<?php the_sub_field('image');?>"
    
    							</a>
    
    						</div>
    
    			    <?php endwhile; ?>
    
    			<?php endif; ?>	
    
    </div>
    	<script>
    			 // trigger Masonry as a callback
    				      function( newElements ) {
    				        // hide new items while they are loading
    				        var $newElems = $( newElements ).css({ opacity: 0 });
    				        // ensure that images load before adding to masonry layout
    				        $newElems.imagesLoaded(function(){
    				          // show elems now they're ready
    				          $newElems.animate({ opacity: 1 });
    				          $container.masonry( 'appended', $newElems, true );
    				        });
    				      }
    	</script>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thread Starter Harryadf

    (@harryadf)

    After hunting around how I can make this work I think it might be because I don’t have any pagination on the page (Which, I think, is how infinite scroll works) this then leads to another question – Does anyone know how to add pagination to masonry in wordpress that allows infinite scroll to then work? Thanks again!! Harry.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Infinite scroller to work with masonry’ is closed to new replies.