Class: XScroll

XScroll

new XScroll(cfg)

Name Type Description
cfg object config for scroll
Name Type Description
SCROLL_ACCELERATION number acceleration for scroll, min value make the scrolling smoothly
BOUNDRY_CHECK_DURATION number duration for boundry bounce
BOUNDRY_CHECK_EASING number easing for boundry bounce
BOUNDRY_CHECK_ACCELERATION number acceleration for boundry bounce
lockX boolean just like overflow-x:hidden
lockY boolean just like overflow-y:hidden
scrollbarX boolean config if the scrollbar-x is visible
scrollbarY boolean config if the scrollbar-y is visible
useTransition boolean config if use css3 transition or raf for scroll animation
useOriginScroll boolean config if use simulate or origin scroll
bounce boolean config if use has the bounce effect when scrolling outside of the boundry
boundryCheck boolean config if scrolling inside of the boundry
preventDefault boolean prevent touchstart
preventTouchMove boolean prevent touchmove
container string | HTMLElement config for scroller's container which default value is ".xs-container"
content string | HTMLElement config for scroller's content which default value is ".xs-content"
indicatorInsets object config scrollbars position {top: number, left: number, bottom: number, right: number}
stickyElements string config for sticky-positioned elements
fixedElements string config for fixed-positioned elements
touchAction string config for touchAction of the scroller
Example
var xscroll = new XScroll({
   renderTo:"#scroll",
   lockX:false,
   scrollbarX:true
});
xscroll.render();

Extends

Members

staticXScroll.versionstring

version

Methods

staticXScroll.boundryCheck(){XScroll}

bounce to the boundry vertical and horizontal

staticXScroll.boundryCheckX(){XScroll}

bounce to the boundry horizontal

staticXScroll.boundryCheckY(){XScroll}

bounce to the boundry vertical

staticXScroll.destroy(){XScroll}

destroy scroll

staticXScroll.disableGPUAcceleration(){XScroll}

staticXScroll.enableGPUAcceleration(){XScroll}

staticXScroll.getScrollLeft(){number}

get scroll left value

staticXScroll.getScrollPos(){Object}

get scroll offset

staticXScroll.getScrollTop(){number}

get scroll top value

staticXScroll.init(){XScroll}

init scroll

staticXScroll.initTouchAction(){XScroll}

init touch action

staticXScroll.render(){XScroll}

render scroll

staticXScroll.resetSize(){XScroll}

reset the boundry size

staticXScroll.scrollBy(scrollLeft, scrollTop, duration, easing)

scroll relative to the destination
Name Type Description
scrollLeft number scrollLeft
scrollTop number scrollTop
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)

staticXScroll.scrollLeft(scrollLeft, duration, easing)

horizontal scroll absolute to the destination
Name Type Description
scrollLeft number scrollLeft
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)

staticXScroll.scrollLeftBy(scrollLeft, duration, easing)

horizontal scroll relative to the destination
Name Type Description
scrollLeft number scrollLeft
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)

staticXScroll.scrollTo(scrollLeft, scrollTop, duration, easing)

scroll absolute to the destination
Name Type Description
scrollLeft number scrollLeft
scrollTop number scrollTop
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)

staticXScroll.scrollTop(scrollTop, duration, easing)

vertical scroll absolute to the destination
Name Type Description
scrollTop number scrollTop
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)

staticXScroll.scrollTopBy(scrollTop, duration, easing)

vertical scroll relative to the destination
Name Type Description
scrollTop number scrollTop
duration number duration for animte
easing string easing functio for animate : ease-in | ease-in-out | ease | bezier(n,n,n,n)