This project is archived and is in readonly mode.

#461 ✓resolved
Aicke Schulz

Fx.SmoothScroll changes back button functionality

Reported by Aicke Schulz | December 16th, 2010 @ 05:37 PM

When using Fx.SmoothScroll, the back button doesn't work any longer as expected.

When I'm on a page and click on a SmoothScroll link, the page is scrolled to the linked element, then the hash is set and the browser has forgotten the scroll position where I clicked the link. That happens again and again if someone clicks other smooth scroll links. So with the back button you jump to the last linked element position but not the position where the user was. That's a bad user experience

I have no other idea then using a history manager to solve the problem, but the side effect would be that you could scroll (!) back to the last position, other then jumping back.

Comments and changes to this ticket

  • JacobThornton

    JacobThornton December 16th, 2010 @ 08:06 PM

    Hey Aicke, could you create a jsfiddle which demonstrates this problem?

  • JacobThornton

    JacobThornton December 16th, 2010 @ 08:09 PM

    • Assigned user set to “JacobThornton”

    actually nevermind -- don't bother creating a fiddle.

    My guess is that we wont be adding a history manager to smoothscroll. This is the intended behavior -- to take you between targets.

  • Arian

    Arian December 16th, 2010 @ 09:20 PM

    • State changed from “new” to “wontfix”

    History management is totally out of the scope of Fx.Smoothscroll. You could use or similar plugins. Furthermore you could use the toElement method (of Fx.SmoothScholl which is inherited of Fx.Scroll) to scroll back to a link.

  • Aicke Schulz

    Aicke Schulz December 17th, 2010 @ 10:14 AM

    I just want to mention one usecase which is really common, maybe my description of the problem wasn't clear enough. Let's use SmoothScroll Using MooTools 1.2 Example by David Walsh.

    1. Click on Chapter 5
    2. Click on browser back button

    There is no other way back to top, then using the top link, because the start position is lost. I don't like the history manager idea too. I thought maybe someone has a better solution for that problem, because we wanted to use that on our page. But the user experience is too bad/uncommon/unexpected, to use that on a page with thousands of visits per day.

    When there is no other solution than a history manager, I accept that this issue won't be fixed.

  • Arian

    Arian December 17th, 2010 @ 06:36 PM

    • State changed from “wontfix” to “resolved”

    Ooh, I think this is already fixed (for the next release) in this commit:
    I was a little to fanatic refactoring Fx.Smoothscroll :)

  • Aicke Schulz

    Aicke Schulz December 20th, 2010 @ 10:00 AM

    Thanks for improving the class.

    I integrated the git summit into mootools more and also tried the offset option but I can't see how the changes resolve this issue.

    Furthermore I can see a ugly page jump with that solution, when the anchor is set. I think that's the effect of the scrollTo() after the hash is set. Just an idea: what about transparent dom elements which are dynamically inserted relative to the anchor elements, and which get the id of the original anchor elements?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket