-
AuthorPosts
-
March 12, 2015 at 1:06 pm #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,
ElainMarch 13, 2015 at 6:52 pm #411216Hey 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.
March 16, 2015 at 5:32 am #411870Hi 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,
ElainMarch 17, 2015 at 2:14 am #412722Hi!
Kriesi just released Enfold 3.1, so it should be fixed after you get the update :)
Regards,
AndyMarch 22, 2015 at 12:52 pm #415946Hi 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.
March 24, 2015 at 3:18 am #416870Hi!
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,
IsmaelMarch 28, 2015 at 9:02 am #419808Thanks – 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?
March 30, 2015 at 6:34 am #420206Hi!
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,
IsmaelMarch 30, 2015 at 1:48 pm #420395Hi Ismael,
Unfortunately that code doesn’t appear to have any effect. The images still appear stacked on each other.April 3, 2015 at 4:15 pm #423138Hi!
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,
ElliottApril 6, 2015 at 3:37 am #423746Hi 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.April 7, 2015 at 7:06 am #424462Hi!
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,
IsmaelApril 12, 2015 at 12:48 pm #427132This reply has been marked as private.April 13, 2015 at 7:05 am #427316Hey!
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!
IsmaelApril 23, 2015 at 2:53 pm #433501This reply has been marked as private.April 24, 2015 at 7:12 am #433895Hey!
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!
IsmaelApril 25, 2015 at 3:24 am #434542Hi 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,
ElainApril 25, 2015 at 6:53 am #434608Hey!
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,
IsmaelApril 25, 2015 at 7:59 am #434625Thanks 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,
ElainApril 25, 2015 at 8:45 am #434631Hey 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!
April 27, 2015 at 5:11 am #435002Hi @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!
RikardApril 27, 2015 at 6:11 am #435024Hi!
@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-433895Best regards,
IsmaelApril 27, 2015 at 2:24 pm #435263That’s great! Thanks Ismael.
-
AuthorPosts
- The topic ‘Masonry Gallery – Images Stacking On Top Of Each Other’ is closed to new replies.