-
Notifications
You must be signed in to change notification settings - Fork 913
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ $(function() { | |
'use strict'; | ||
|
||
var pager = Mozilla.Pager.pagers[0]; | ||
var documentRoot = $(document); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
var firstPager = $('.pager').first(); | ||
|
||
// scroll to top of pager when switching tabs so all | ||
// tab content is visible after switching tabs | ||
|
@@ -15,12 +17,12 @@ $(function() { | |
var scrollPos = $(document).scrollTop(); | ||
|
||
// Get the offset of the top of the pager section | ||
var pagerTopPos = $('.pager').first().offset().top; | ||
var pagerTopPos = $(firstPager).offset().top; | ||
|
||
// If we're scrolled passed the header, jump back up | ||
// to the tabs when the tab is switched | ||
if (scrollPos > pagerTopPos) { | ||
$('html, body').scrollTop($('.pager').first().offset().top); | ||
$(documentRoot).scrollTop($(firstPager).offset().top); | ||
This comment has been minimized.
Sorry, something went wrong.
alexgibson
Member
|
||
} | ||
}); | ||
|
||
|
Nit: reference jQuery objects with a
$
prefix, e.g.var $documentRoot = $(document);