• Resolved andytela

    (@andymoonshine)


    Hi

    $.fn.almComplete doesn’t fire when going back
    I’m presuming this is to do with the page caching for back buttons

    The problem is I’m using masonry on a page that when it goes back then the masonry doesn’t fire as this is in the $.fn.almComplete

    I’ve tried using the pageshow event but the event.persisted doesn’t work with Chrome or older IE

    Do you know a way around this?

    Cheers
    Andy

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andytela

    (@andymoonshine)

    Hi

    For anyone interested I resolved this by just looking for the container on page load

    if( $('.alm_container .alm-listing .alm-reveal').length ){
    // code...
    }

    So if the page is loaded through the bfcache then the ALM elements are already on the page

    Cheers
    Andy

    Plugin Author Darren Cooney

    (@dcooney)

    Hi Andy,
    Thanks for posting your solution.
    Im not sure I understand the issue but glad to hear that you sorted it out!
    ??

    Thread Starter andytela

    (@andymoonshine)

    Hi

    No worries

    Basically when using a back button in the browser, rather than using the standard page cache as if you went to a page you’d visited before it uses what Mozilla like to term bfcache, so it renders the page in it’s last state
    But due to the plugin using AJAX, this is not called as it already has the state loaded

    So anything you do which is called in the $.fn.almComplete will never be fired as the page won’t fire the AJAX but the content is already rendered, but because I was then calling masonry, this was never called so the page didn’t format correctly

    Took me a while to figure that , but got there in the end! ??

    Cheers
    Andy

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘almComplete not firing on back button’ is closed to new replies.