Class: SimuScroll

SimuScroll

new SimuScroll(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
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 SimuScroll({
   renderTo:"#scroll",
   lockX:false,
   scrollbarX:true
});
xscroll.render();

Extends

Methods

staticSimuScroll.boundryCheck(){SimuScroll}

bounce to the boundry vertical and horizontal

staticSimuScroll.boundryCheckX(){SimuScroll}

bounce to the boundry horizontal

staticSimuScroll.boundryCheckY(){SimuScroll}

bounce to the boundry vertical

staticSimuScroll.computeScroll(zoomType, velocity){Object}

compute scroll transition by zoomType and velocity
Name Type Description
zoomType string zoomType of scrolling
velocity number velocity after panend
Example
var info = xscroll.computeScroll("x",2);
// return {pos:90,easing:"easing",status:"inside",duration:500}

staticSimuScroll.destroyScrollBars(){SimuScroll}

destroy scrollbars

staticSimuScroll.getBoundryOutBottom(){number}

get the offset value outsideof bottom

staticSimuScroll.getBoundryOutLeft(){number}

get the offset value outsideof left

staticSimuScroll.getBoundryOutRight(){number}

get the offset value outsideof right

staticSimuScroll.getBoundryOutTop(){number}

get the offset value outsideof top

staticSimuScroll.getScrollLeft(){number}

get scroll left value

staticSimuScroll.getScrollTop(){number}

get scroll top value

staticSimuScroll.init()

staticSimuScroll.initController(){SimuScroll}

init controller for multi-scrollers

staticSimuScroll.initScrollBars(){SimuScroll}

init scrollbars

staticSimuScroll.isBoundryOut(){boolean}

judge the scroller is out of boundry horizontally and vertically

staticSimuScroll.isBoundryOutBottom(){boolean}

judge if the scroller is outsideof bottom

staticSimuScroll.isBoundryOutLeft(){boolean}

judge if the scroller is outsideof left

staticSimuScroll.isBoundryOutRight(){boolean}

judge if the scroller is outsideof right

staticSimuScroll.isBoundryOutTop(){boolean}

judge if the scroller is outsideof top

staticSimuScroll.render(){SimuScroll}

render scroll

staticSimuScroll.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)

staticSimuScroll.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)

staticSimuScroll.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)

staticSimuScroll.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)

staticSimuScroll.stop(){SimuScroll}

stop scrolling immediatelly

staticSimuScroll.translate(x, y, scale)

translate the scroller to a new destination includes x , y , scale
Name Type Description
x number x
y number y
scale number scale