WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19534 closed enhancement (duplicate)

Scroll to top on Toolbar click

Reported by: ericmann Owned by: ericmann
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Toolbar Keywords: has-patch needs-testing
Focuses: Cc:

Description

Google+ introduced a fantastic feature with their toolbar. If you're scrolled far down a page, clicking any non-link in the toolbar automatically scrolls back to the top of the page.

When viewing a very long WordPress front-end (or a long list of comments/large settings page on the WordPress back-end), this would be a fantastic tool. It's also better to have a consistent UX control built in to the system rather than the various spin-your-own hacks different developers have built over the years.

I propose we add this "back to top" functionality to the WordPress toolbar. It should necessarily work with or without jQuery (in situations where themes don't enqueue jQuery on the front-end but still display the toolbar).

Attachments (1)

19534.diff (1.8 KB) - added by ericmann 2 years ago.
Add a back-to-top function for both the jQuery and non-jQuery parts of the toolbar script.

Download all attachments as: .zip

Change History (6)

ericmann2 years ago

Add a back-to-top function for both the jQuery and non-jQuery parts of the toolbar script.

comment:1 ericmann2 years ago

  • Keywords has-patch needs-testing added

This patch adds a very basic scrollTop animation on a jQuery hook (the click event on the toolbar). It also adds a smooth, non-jQuery animation to the onclick event of the toolbar. Target ID filtering is used to eliminate capturing clicks on actual buttons/dropdowns in the toolbar as well.

comment:2 andrea_r2 years ago

  • Cc andrea@… added

comment:3 trepmal2 years ago

Love this :)

I keep expecting this sort of thing to work everywhere there's a fixed header/toolbar, including twitter (where -sadly- it doesn't work)

comment:4 follow-up: ocean902 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

comment:5 in reply to: ↑ 4 ericmann2 years ago

Replying to ocean90:

#18758

That ticket didn't show up in my initial search. Apparently I didn't look hard enough. Patch moved to proper ticket and comments added there as well. Thanks!

Note: See TracTickets for help on using tickets.