Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19534 closed enhancement (duplicate)

Scroll to top on Toolbar click

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


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 12 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)

12 years ago

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

#1 @ericmann
12 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.

#2 @andrea_r
12 years ago

  • Cc andrea@… added

#3 @trepmal
12 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)

#4 follow-up: @ocean90
12 years ago

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

#5 in reply to: ↑ 4 @ericmann
12 years ago

Replying to ocean90:


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.