SimpleSlideView icon indicating copy to clipboard operation
SimpleSlideView copied to clipboard

Another little code question (variable: top)

Open lyzadanger opened this issue 11 years ago • 1 comments

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!

lyzadanger avatar Apr 24 '14 17:04 lyzadanger

@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. :confused:

tylersticka avatar Apr 24 '14 17:04 tylersticka