Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Can you turn off the Enable Window scrolling in the ALM settings for Previous post?

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Turned it off, so if I load a new post the window is not scrolling to the new post. But the bug remains.

    If I open my menu, wich adds a #menu-open to the url the window jumps. But somehow the hash gets removed instantly and it looks like this is causing the jump. Could this come from your plugin? Cause the menu works on every page except my news pages, where I’m also using your plugin.

    Update #1:
    Ok now I now that the following of your code in alm-previous-post.js (line 68) removes my #menu-open url hash. But even when i comment that line out the jump still happens.

    if(url !== permalink){
      almPreviousPost.setURL(id, permalink, title);
    }
    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Update #2:
    Ok now I now that the following code in alm-previous-post.js (line 143) is causing the page jump.

    var top = $('.alm-reveal.alm-previous-post.post-'+id).offset().top - almPreviousPost.offset + 5;
    $('html, body').animate({ scrollTop: top +'px' }, 1, function(){
      almPreviousPost.popstate = false;
    });

    Since this code gets executed on “popstate” it looks like that my script fires an “popstate” when I add that hash to the url.

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    I was able to solve this by changing my menu code to not fire any popstates.
    So from my perspective this is resolved.

    However I suggest you to think about these parts of code.

    Destroys the basic use of internal anchor links cause it always checks the url on a scroll event and removes added hashes! Thats not very nice 😉

    if(url !== permalink){
      almPreviousPost.setURL(id, permalink, title);
    }

    Shouldn’t this code also be disabled if the user decided to set the “Scroll to Post” setting to false?

    var top = $('.alm-reveal.alm-previous-post.post-'+id).offset().top - almPreviousPost.offset + 5;
    $('html, body').animate({ scrollTop: top +'px' }, 1, function(){
      almPreviousPost.popstate = false;
    });

    If you want you can mark this as resolved (just leaving it open to make sure you read this last comment).

    Plugin Author Darren Cooney

    (@dcooney)

    I guess so, but what’s the point in clicking the back/fwd button if you don’t move to that post?

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Just wanted to mention, maybe there is a better solution, but I have no suggestion at the moment. If you want make a note or just leave it as it is 😉

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Previous Post Addon and Url Parameters’ is closed to new replies.