• Version 2.5.1
  • Published
  • 397 kB
  • 1 dependency
  • MIT license


npm i @better-scroll/core
yarn add @better-scroll/core
pnpm add @better-scroll/core


Minimalistic core scrolling for BetterScroll, it is pure and tiny



variable BScroll

const BScroll: BScrollFactory;


    function createBScroll

    createBScroll: typeof createBScroll;


      class Behavior

      class Behavior {}


        constructor(wrapper: HTMLElement, content: HTMLElement, options: Options);

          property absStartPos

          absStartPos: number;

            property content

            content: HTMLElement;

              property contentSize

              contentSize: number;

                property currentPos

                currentPos: number;

                  property direction

                  direction: number;

                    property dist

                    dist: number;

                      property hasScroll

                      hasScroll: boolean;

                        property hooks

                        hooks: EventEmitter;

                          property maxScrollPos

                          maxScrollPos: number;

                            property minScrollPos

                            minScrollPos: number;

                              property movingDirection

                              movingDirection: number;

                                property options

                                options: Options;

                                  property relativeOffset

                                  relativeOffset: number;

                                    property startPos

                                    startPos: number;

                                      property wrapper

                                      wrapper: HTMLElement;

                                        property wrapperSize

                                        wrapperSize: number;

                                          method adjustPosition

                                          adjustPosition: (pos: number) => number;

                                            method checkInBoundary

                                            checkInBoundary: () => { position: number; inBoundary: boolean };

                                              method computeBoundary

                                              computeBoundary: () => void;

                                                method destroy

                                                destroy: () => void;

                                                  method end

                                                  end: (duration: number) => {
                                                  destination?: number | undefined;
                                                  duration?: number | undefined;

                                                    method getAbsDist

                                                    getAbsDist: (delta: number) => number;

                                                      method getCurrentPos

                                                      getCurrentPos: () => number;

                                                        method move

                                                        move: (delta: number) => number;

                                                          method performDampingAlgorithm

                                                          performDampingAlgorithm: (delta: number, dampingFactor: number) => number;

                                                            method refresh

                                                            refresh: (content: HTMLElement) => void;

                                                              method resetStartPos

                                                              resetStartPos: () => void;

                                                                method setDirection

                                                                setDirection: (delta: number) => void;

                                                                  method setMovingDirection

                                                                  setMovingDirection: (delta: number) => void;

                                                                    method start

                                                                    start: () => void;

                                                                      method updateAbsStartPos

                                                                      updateAbsStartPos: () => void;

                                                                        method updateDirection

                                                                        updateDirection: () => void;

                                                                          method updatePosition

                                                                          updatePosition: (pos: number) => void;

                                                                            method updateStartPos

                                                                            updateStartPos: () => void;

                                                                              class CustomOptions

                                                                              class CustomOptions {}


                                                                                interface BScrollInstance

                                                                                interface BScrollInstance extends ExposedAPIByScroller, ExposedAPIByAnimater {}

                                                                                  property directionX

                                                                                  directionX: Behavior['direction'];

                                                                                    property directionY

                                                                                    directionY: Behavior['direction'];

                                                                                      property enabled

                                                                                      enabled: Actions['enabled'];

                                                                                        property hasHorizontalScroll

                                                                                        hasHorizontalScroll: Behavior['hasScroll'];

                                                                                          property hasVerticalScroll

                                                                                          hasVerticalScroll: Behavior['hasScroll'];

                                                                                            property maxScrollX

                                                                                            maxScrollX: Behavior['maxScrollPos'];

                                                                                              property maxScrollY

                                                                                              maxScrollY: Behavior['maxScrollPos'];

                                                                                                property minScrollX

                                                                                                minScrollX: Behavior['minScrollPos'];

                                                                                                  property minScrollY

                                                                                                  minScrollY: Behavior['minScrollPos'];

                                                                                                    property movingDirectionX

                                                                                                    movingDirectionX: Behavior['movingDirection'];

                                                                                                      property movingDirectionY

                                                                                                      movingDirectionY: Behavior['movingDirection'];

                                                                                                        property pending

                                                                                                        pending: Animater['pending'];

                                                                                                          property scrollerHeight

                                                                                                          scrollerHeight: Behavior['contentSize'];

                                                                                                            property scrollerWidth

                                                                                                            scrollerWidth: Behavior['contentSize'];

                                                                                                              property x

                                                                                                              x: Behavior['currentPos'];

                                                                                                                property y

                                                                                                                y: Behavior['currentPos'];

                                                                                                                  index signature

                                                                                                                  [key: string]: any;

                                                                                                                    interface CustomAPI

                                                                                                                    interface CustomAPI {}

                                                                                                                      index signature

                                                                                                                      [key: string]: {};

                                                                                                                        interface CustomOptions

                                                                                                                        interface CustomOptions {}

                                                                                                                          interface MountedBScrollHTMLElement

                                                                                                                          interface MountedBScrollHTMLElement extends HTMLElement {}

                                                                                                                            property isBScrollContainer

                                                                                                                            isBScrollContainer?: boolean;

                                                                                                                              interface Options

                                                                                                                              interface Options extends DefOptions, CustomOptions {}

                                                                                                                                interface TranslaterPoint

                                                                                                                                interface TranslaterPoint {}

                                                                                                                                  property x

                                                                                                                                  x: number;

                                                                                                                                    property y

                                                                                                                                    y: number;

                                                                                                                                      index signature

                                                                                                                                      [key: string]: number;

                                                                                                                                        Type Aliases

                                                                                                                                        type Boundary

                                                                                                                                        type Boundary = {
                                                                                                                                        minScrollPos: number;
                                                                                                                                        maxScrollPos: number;

                                                                                                                                          type BScroll

                                                                                                                                          type BScroll<O = Options> = BScrollConstructor<O> &


                                                                                                                                            namespace createBScroll

                                                                                                                                            namespace createBScroll {}

                                                                                                                                              variable plugins

                                                                                                                                              var plugins: PluginItem[];

                                                                                                                                                variable pluginsMap

                                                                                                                                                var pluginsMap: PluginsMap;

                                                                                                                                                  variable use

                                                                                                                                                  var use: (ctor: PluginCtor) => typeof BScrollConstructor;

                                                                                                                                                    Package Files (6)

                                                                                                                                                    Dependencies (1)

                                                                                                                                                    Dev Dependencies (0)

                                                                                                                                                    No dev dependencies.

                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                    No peer dependencies.


                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@better-scroll/core.

                                                                                                                                                    • Markdown
                                                                                                                                                    • HTML
                                                                                                                                                      <a href="https://www.jsdocs.io/package/@better-scroll/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>