Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

when the scroller's height is less than the wrapper'height #929

Open
yqz0203 opened this issue Jun 17, 2015 · 6 comments
Open

when the scroller's height is less than the wrapper'height #929

yqz0203 opened this issue Jun 17, 2015 · 6 comments

Comments

@yqz0203
Copy link

yqz0203 commented Jun 17, 2015

when the scroller's height is less than the wrapper'height,i can't scroll anyway.

it cause a problem, I need pull to refresh the data, but I can't pull at all...

whether i should set a min-height to the scroller?

@swenyang
Copy link

swenyang commented May 11, 2016

I found a solution for this, just set the scroller's "min-height" property slightly larger than the wrapper's, either in CSS(if the wrapper's height is static) or programmatically in JS(if the wrapper's height is dynamic).

var wrapper = document.getElementById("wrapper")
var scroller = document.getElementById("scroller")
scroller.style.minHeight = (wrapper.clientHeight + 1) + "px"
var myIScroll = new iScroll(wrapper, {/*your options*/})

@yqz0203
Copy link
Author

yqz0203 commented May 16, 2016

@swenyang yes..I solved it like you said, thank you for replying after such a long time. 😊

@kaansoral
Copy link

I had a solution is iscroll level, if the content height is lower, iScroll wasn't enabling scroll, you can modify that part of the code to make it always scroll

This solution is obviously simpler, if there are no side effects

@swenyang
Copy link

@kaansoral If your team is managing packages with npm or bower, modifying library code directly is not good. Also, could you show your code to tell which line to modify?

@kaansoral
Copy link

Indeed it's not good, I'm stuck at 5.1.3 for example, it was good until this package started being maintained again

Just checked the code, here is the modification:

/* REPLACE START: refresh */

        this.scrollerWidth  = this.scroller.offsetWidth;
        this.scrollerHeight = this.scroller.offsetHeight;

        this.maxScrollX     = this.wrapperWidth - this.scrollerWidth;
        this.maxScrollY     = this.wrapperHeight - this.scrollerHeight;

        if(this.maxScrollY>=0) this.maxScrollY=-1; // #CUSTOM - forcing the scroll even if the height is low

/* REPLACE END: refresh */

@swenyang
Copy link

Thanks, basically it's working except that the scrollbar doesn't display correctly on scrolling..

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

No branches or pull requests

3 participants