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

Another little code question (variable: top) #18

Open
lyzadanger opened this issue Apr 24, 2014 · 1 comment
Open

Another little code question (variable: top) #18

lyzadanger opened this issue Apr 24, 2014 · 1 comment
Assignees
Labels

Comments

@lyzadanger
Copy link

Hiya!

This line in lib/simpleslideview.js: https://github.com/cloudfour/SimpleSlideView/blob/master/lib/simpleslideview.js#L266

Is in the beforeChangeEnd callback:

      beforeChangeEnd = function() {
        if (_this.options.resizeHeight) {
          if (_this.options.maintainViewportHeight && window.innerHeight > _this.lastViewportHeight) {
            _this.lastViewportHeight = window.innerHeight;
            $html.css('min-height', (_this.lastViewportHeight + top) + 'px');
          }
          return _this.$container.animate({
            height: outerHeight($targetView)
          }, _this.options.heightDuration, _this.options.easing, onChangeEnd);
        } else {
          return onChangeEnd();
        }
      };

top isn't defined. Not sure what it should be so need a bit of input to fix it!

@tylersticka
Copy link
Member

@lyzadanger Weird! Honestly, I don't remember in this context. It may not be necessary.

To explain what the goal of this portion is... sometimes if you're on a mobile browser, scrolling to a very short view after viewing a very long one can feel kinda gnarly. Because the actual page height is shrinking as well, the animation can feel sudden and jerky. When the maintainViewportHeight option is true, the min-height of html is set to whatever the largest view so far is, allowing the page height to remain more consistent.

I'm sorry this method is so janky. 😕

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

2 participants