Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #410417

    Hello,

    I was directed to create a thread here asking about this issue from a post I made on ThemeForest. We are using the Full Width Masonry Gallery, and notice that often when loading a page that has a lot of images on it (~50 -> 100) the images don’t get laid out properly. Instead they all stack on top of each other like cards. As soon as I adjust the screen size, the images suddenly move to their correct positions – but the initial load is incorrect.

    I found an old topic about this and the fix was to insert some JS that triggers a window resize, once the page has loaded. This was from 2013 however, and I was thinking by now this issue should be resolved in the main branch. Are you able to confirm, and suggest a solution – or do we still need to use the workaround suggested (which appears not to function on all browsers 100%).

    Thanks,
    Elain

    #411216

    Hey ElainL!

    I can only see the issue on the first seconds, when images are still loading and when I am looking at your page for the first time. After loading time is finished, the masonry gallery is showing fine your pictures. I think you could increase loading speed by using 72dpi instead of 200dpi for your images.

    Cheers!
    Andy

    • This reply was modified 9 years, 9 months ago by Andy.
    #411870

    Hi Andy,

    I do realised that the gallery is showing find again after loading time is finish. This might be because I have added the code suggested by Josue on a similar sort of post on 19 November 2013

    This is the code:
    jQuery(window).on(‘load’, function(){
    jQuery(window).resize();
    });

    I will definitely try to change all images to 72dpi now. But I am just wondering if this bug has been fixed yet as Josue mentioned before on his post stating that this code is just a temporary solution, and a final fix will be included in future releases.

    Regards,
    Elain

    #412722

    Hi!

    Kriesi just released Enfold 3.1, so it should be fixed after you get the update :)

    Regards,
    Andy

    #415946

    Hi Andy,

    We have just updated our site and see no difference. We added the code snippet manually and it resolves the issue albeit only when the page has completed loading, which is not ideal for a gallery since the page load times are long.

    Please advise.

    #416870

    Hi!

    The fix is not included on the latest update because not all gallery installation have this issue. I guess this only happens to websites with multiple and heavy images. You can remove the code on avia.js then add this to the functions.php file:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$(this).trigger('resize');
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    The code above will also resize the windows automatically, forcing the gallery images to adjust to the correct position.

    Best regards,
    Ismael

    #419808

    Thanks – that does indeed solved the issue once the page has finished loading. Is there a way to resolve this which doesn’t require the full page to have finished loading?

    #420206

    Hi!

    Try to replace the code with this:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        	$(window).trigger('resize');
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Best regards,
    Ismael

    #420395

    Hi Ismael,
    Unfortunately that code doesn’t appear to have any effect. The images still appear stacked on each other.

    #423138

    Hi!

    Is there a certain page it’s happening on? I tried viewing some of the pages under “Wedding Albums” but all of the Masonry images are displaying fine.

    Regards,
    Elliott

    #423746

    Hi Elliott,
    It’s happening on all the albums especially on ‘Wedding Ceremony 1’ & ‘Wedding Reception 1’. The stacking problem when away once the page has finished loading. This is because I have included the code suggested by Ismael previously that will resize the windows automatically, forcing the gallery images to adjust to the correct position.

    #424462

    Hi!

    I checked the site but I cannot reproduce the issue anymore. Please create a test page with a gallery element. Add more than 8 gallery items.

    Regards,
    Ismael

    #427132
    This reply has been marked as private.
    #427316

    Hey!

    Yes, please create a test page. Post the login details here. We would like to check it. :)

    I noticed that the images are not fully optimized. Maybe, having a fully optimized gallery images will fix the issue. Let’s check this image for example: http://www.tinyillusion.com/wp-content/uploads/2014/12/Ian-Elain-793-1030×686.jpg

    I was able to reduce the file size from 288KB to 140KB+, just by resaving the images using photoshop. I set the file format to jpeg and quality to 8 or 9, you think that this will lower the image quality but it doesn’t. You won’t be able to tell the difference, at least not in most cases. I’m not a photographer so maybe I don’t see it clearly. If you don’t want to do this manually, you can try this plugin: https://wordpress.org/plugins/ewww-image-optimizer/

    Cheers!
    Ismael

    #433501
    This reply has been marked as private.
    #433895

    Hey!

    Thank you for the login details but I think you forgot to set it as admin so we can’t edit anything. Please check the user rights. Anyway, please remove the first auto resize function then replace it with this:

    add_action('wp_footer', 'ava_auto_resize');
    function ava_auto_resize(){
    ?>
    <script>
    (function($){	
    	var int = window.setInterval(function(){
    		$(window).trigger('resize');
    	}, 2000);
    	
    	$(window).load(function () {
    		setTimeout(function() {
    			clearInterval(int);
    		}, 5000);
    	});
    })(jQuery);
    </script>
    <?php
    }

    This will trigger the resize event every two seconds and force the gallery items to adjust their position. It will stop after 5 seconds the page has been fully loaded. I hope it fix the issue.

    Cheers!
    Ismael

    #434542

    Hi Ismael,
    I have just changed the user rights to Admin.

    I am not too sure where to find the code for the first auto resize function. I have updated the parent enfold theme to 3.1.3 few weeks ago and the code that I have added prior to that is not there anymore.

    Besides, I’m just wondering if I can add the code to my Enfold-Child theme? or do I need to add the code to the parent theme manually each time when I update the theme?

    Regards,
    Elain

    #434608

    Hey!

    It’s in the functions.php file. The code is working. As you can see the gallery items automatically adjust their position while loading. Remove browser cache then reload the page: http://www.tinyillusion.com/test-page-for-gallery/

    Regards,
    Ismael

    #434625

    Thanks Ismael. It’s working! So, did you replace the code on functions.php under Enfold Child theme? Do I need to do anything next time when there’s an update on the parent theme?

    Regards,
    Elain

    #434631

    Hey sorry to jump in on this thread but just wanted to say I’ve had the same issue since launching my enfold site in Nov…I’ve always kept up to date and tried a few things that were suggested when I started a similar topic. If the mods here have hit on a solution, I’d sure love to know how to incorporate it!

    #435002

    Hi @johnlaunstein!

    Did you try the previous suggestions in the thread? Please post a link to your site so that we can check it out for ourselves.

    Cheers!
    Rikard

    #435024

    Hi!


    @ElainL
    : Yes, it is on the child theme’s functions.php file. You don’t need to do anything when you update the theme.


    @John
    : Add the code in the functions.php file: https://kriesi.at/support/topic/masonry-gallery-images-stacking-on-top-of-each-other/#post-433895

    Best regards,
    Ismael

    #435263

    That’s great! Thanks Ismael.

Viewing 23 posts - 1 through 23 (of 23 total)
  • The topic ‘Masonry Gallery – Images Stacking On Top Of Each Other’ is closed to new replies.