leafo / sticky-kit

A jQuery plugin for creating smart sticky elements
http://leafo.net/sticky-kit
2.9k stars 517 forks source link

sticky div jumpy when scrolling down, fine when scrolling up #207

Open bibliofille opened 8 years ago

bibliofille commented 8 years ago

I used sticky kit to have a div (project-info) remain in place once it reaches the top of the page. Then the images in the right column continue scrolling. This feature only works on desktop.

It works great when scrolling back up the page, however, it is a bit jumpy when scrolling down initially, and the entire .project-info div doesn't stay in view when scrolling down.

I'm not sure I did anything differently, since it was working before. The client entered a bunch of content, but I don't think that should be throwing it off.

Here's my URL: http://propellerfund.flywheelsites.com/projects/filmfront/ (Flywheel requires a password for dev sites, so the username is:flywheel; password: propellerfund)

Here's my sticky kit code: `jQuery(document).ready(function(){

var window_width = jQuery( window ).width();

if (window_width < 768) {
  jQuery(".project-info").trigger("sticky_kit:detach");
} else {
  make_sticky();
}

jQuery( window ).resize(function() {

  window_width = jQuery( window ).width();

  if (window_width < 768) {
    jQuery(".project-info").trigger("sticky_kit:detach");
  } else {
    make_sticky();
  }

});

function make_sticky() {
  jQuery(".project-info").stick_in_parent({
  });
}

});`

jan1980 commented 7 years ago

+1 I'm facing the same issue please help!