Skip to content

Commit

Permalink
See #122: Merged new maxWidth option.
Browse files Browse the repository at this point in the history
  • Loading branch information
bigspotteddog committed Jan 17, 2014
1 parent 0b526a7 commit 57b1575
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ var b = $.isScrollToFixed('.header');
* __postAbsolute__ - the function handler triggered just after the element leaves absolute.
* __offsets__ - (true|false|not present) some websites have needed an adjustment to the left position of the element due to something in their layout. This option turns this adjustment on.
* __minWidth__ (number) - the minimum width the window must be to "fix" the target element. Turns off the functionaility when the window width is less than specified.
* __maxWidth__ (number) - the maximum width the window must be to "fix" the target element. Turns off the functionaility when the window width is more than specified.
* __dontCheckForPositionFixedSupport__ - (true|false|not present) some devices do not support position fixed; we check to see if it does. This option turns off that check if set to true.
* __dontSetWidth__ - (true|false|not set) box sizing that does not set the width on the target element when it goes fixed or absolute.
* __removeOffsets__ - (true|false|not set) recalculate top offset and delete left offset when the element goes absolute.
Expand Down
2 changes: 1 addition & 1 deletion jquery-scrolltofixed-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion jquery-scrolltofixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
}
} else if (base.options.maxWidth && $(window).width() > base.options.maxWidth) {
if (!isUnfixed() || !wasReset) {
postPosition();
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
}
} else if (base.options.bottom == -1) {
// If the vertical scroll position, plus the optional margin, would
// put the target element at the specified limit, set the target
Expand Down Expand Up @@ -355,7 +362,7 @@
if(target.is(':visible')) {
isReset = false;
checkScroll();
}
}
}

var windowScroll = function(event) {
Expand Down

0 comments on commit 57b1575

Please sign in to comment.