Browse Source

Fix issues with sticky when doesntFit scroll being slow

pull/2092/head
jlukic 9 years ago
parent
commit
1d479395c2
2 changed files with 8 additions and 11 deletions
  1. 10
      src/definitions/modules/sticky.js
  2. 9
      src/themes/default/modules/sticky.variables

10
src/definitions/modules/sticky.js

@ -294,14 +294,14 @@ $.fn.sticky = function(parameters) {
window = module.cache.window, window = module.cache.window,
delta = module.get.scrollChange(scroll), delta = module.get.scrollChange(scroll),
maxScroll = (element.height - window.height + settings.offset), maxScroll = (element.height - window.height + settings.offset),
currentScroll = module.get.currentElementScroll(),
possibleScroll = (currentScroll + delta),
elementScroll = module.get.currentElementScroll(),
possibleScroll = (elementScroll + delta),
elementScroll elementScroll
; ;
if(module.cache.fits || possibleScroll < 0) { if(module.cache.fits || possibleScroll < 0) {
elementScroll = 0; elementScroll = 0;
} }
else if (possibleScroll > maxScroll ) {
else if(possibleScroll > maxScroll ) {
elementScroll = maxScroll; elementScroll = maxScroll;
} }
else { else {
@ -404,7 +404,9 @@ $.fn.sticky = function(parameters) {
bottom : cachedPosition + offset + window.height bottom : cachedPosition + offset + window.height
}, },
direction = module.get.direction(scroll.top), direction = module.get.direction(scroll.top),
elementScroll = module.get.elementScroll(scroll.top),
elementScroll = (fits)
? 0
: module.get.elementScroll(scroll.top),
// shorthand // shorthand
doesntFit = !fits, doesntFit = !fits,

9
src/themes/default/modules/sticky.variables

@ -2,11 +2,6 @@
Sticky Sticky
*******************************/ *******************************/
@transitionDuration: 0.2s;
@transition:
width @transitionDuration @defaultEasing,
height @transitionDuration @defaultEasing,
top @transitionDuration @defaultEasing,
bottom @transitionDuration @defaultEasing
;
@transitionDuration: @defaultDuration;
@transition: none;
@zIndex: 800; @zIndex: 800;
Loading…
Cancel
Save