Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails when sticky box changes height #16

Open
Dordrecht opened this issue Jun 13, 2014 · 3 comments
Open

Fails when sticky box changes height #16

Dordrecht opened this issue Jun 13, 2014 · 3 comments
Labels

Comments

@Dordrecht
Copy link

My project requirements stipulate that certain user actions on the page will append or remove certain content to/from the floating box, changing its height dynamically. It appears that stickyMojo's upper and lower scrolling bounds are thrown off when this occurs, leading me to believe that some recalculation of positioning is required when the box content changes. I see no relevant function to do this, though.

@samccone samccone added the bug label Jun 13, 2014
@patryk-uszynski
Copy link

I had the same problem. Fast solution:
At line (about) 32 add scroll event:

  return this.each(function() {
    $(window).scroll(function() {
        calculateLimits();          
    });
    buildSticky();
  });

In calculateLimits(), you should change stickyHeight to sticky.el.outerHeight(true) like this:

  function calculateLimits() {
    return {            
      limit: settings.footerID.offset().top - sticky.el.outerHeight(true),
      windowTop: sticky.win.scrollTop(),
      stickyTop: sticky.stickyTop2 - sticky.marg - sticky.offsetTop
    }
  }

@samccone
Copy link
Contributor

@kr4SHh do you have any interest in opening a PR?

@patryk-uszynski
Copy link

@samccone I want, but I havent access to my computer now. I can do it on Friday or at weekend.

I think we should also do smth with similar issue - sticky break bottom limit when the content size decrease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants