index.js
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { eventMixin } from './scroll/event'
import { initMixin } from './scroll/init'
import { coreMixin } from './scroll/core'
import { snapMixin } from './scroll/snap'
import { wheelMixin } from './scroll/wheel'
import { scrollbarMixin } from './scroll/scrollbar'
import { pullDownMixin } from './scroll/pulldown'
import { pullUpMixin } from './scroll/pullup'
import { mouseWheelMixin } from './scroll/mouse-wheel'
import { zoomMixin } from './scroll/zoom'
import { infiniteMixin } from './scroll/inifinity'
import { warn } from './util/debug'
function BScroll(el, options) {
this.wrapper = typeof el === 'string' ? document.querySelector(el) : el
if (!this.wrapper) {
warn('Can not resolve the wrapper DOM.')
}
this.scroller = this.wrapper.children[0]
if (!this.scroller) {
warn('The wrapper need at least one child element to be scroller.')
}
// cache style for better performance
this.scrollerStyle = this.scroller.style
this._init(options)
}
initMixin(BScroll)
coreMixin(BScroll)
eventMixin(BScroll)
snapMixin(BScroll)
wheelMixin(BScroll)
scrollbarMixin(BScroll)
pullDownMixin(BScroll)
pullUpMixin(BScroll)
mouseWheelMixin(BScroll)
zoomMixin(BScroll)
infiniteMixin(BScroll)
BScroll.Version = '1.14.1'
export default BScroll