• Good day,

    I’m having an issue where the post previews on the front page flash while loading. It looks like it may be loading the previews before loading the code for masonry, but I’m not totally sure.

    The issue also occurred with my test site with only security plugins activated, as well the theme’s demo website, so I don’t think it’s an issue with my configuration.

    Here is a video demonstrating the issue: https://www.youtube.com/watch?v=LEGeTk6_4F8

    Thanks

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

    (@carbybarby838)

    I’ve figured out a temporary fix. It involves editing the Javascript included with the theme and adding some custom CSS, so I recommend that anyone who wants to use this fix BACK UP THEIR THEME FILES before attempting it. An official fix should be implemented by the developer and released as a theme update.

    The easiest way to perform this fix would be to use FTP, but it may also be possible without it. I recommend making a child theme to implement all custom CSS (not just the CSS for this fix, all custom CSS), but if you already use a plugin or the WordPress customizer for your CSS, it’s more important that you put all custom CSS in the same place (your website will load slower if there’s multiple CSS files).

    Lastly, I am not a web developer. I found this temporary fix by Googling stuff and making some good guesses.

    Step 1:
    Using FTP, navigate to your website’s theme folder for Hamilton. Download copies of the style.css and the global.js files, just in case something goes wrong. style.css is in the Hamilton folder, and global.js is in Hamilton–>assets–>js

    Step 2:
    Open the global.js file. You’re going to replace a certain block of code. In the “Masonry blocks” section, find the following code:

    $container.imagesLoaded().done( function(){
    		masonryInit();
    		fadeInSpotted();
    		$container.animate({ opacity: 1.0 }, 500 );
    	});

    and replace it with this:

    $container.imagesLoaded().done( function(){
    		masonryInit();
    		fadeInSpotted();
    		$container.addClass('masonry');
    	});

    After you have replaced this code, save the file.

    Step 3:

    Add this custom CSS using whatever method best suits your needs:

    div#posts.posts {
    	opacity: 0;
    	transition: opacity 1000ms;
    }
    div#posts.posts.masonry {
    	opacity: 1;
    }

    That’s all. Your front page/archive pages should no longer flash while loading. If you’d like your post previews to load in slower or faster, you can adjust the “transition: opacity” number as needed.

    Peace

    Edit: words, formatting

    • This reply was modified 6 years, 2 months ago by carbybarby838.
    Thread Starter carbybarby838

    (@carbybarby838)

    Correction, yes, you should definitely be able to do this without an FTP client. Simply open the WordPress editor. (Seriously though, back up your files first.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Front page previews flash when loading’ is closed to new replies.