bianco.viewport

[![Build Status][ci-image]][ci-url] [![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url]

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
bianco.viewport
1.1.02 years ago7 years agoMinified + gzip package size for bianco.viewport in KB

Readme

bianco.viewport
!Build Statusci-imageci-url !NPM versionnpm-version-imagenpm-url !NPM downloadsnpm-downloads-imagenpm-url !MIT Licenselicense-imagelicense-url

Usage

import viewport from 'bianco.viewport'

// get the current scroll top position
const offsetTop = viewport.scrollTop()

API

Table of Contents

-   [Parameters](#parameters)
-   [Parameters](#parameters-1)

scrollbarWidth

Return the size of the scrollbar that depends on the browser or device used on the client
Returns number the browser scrollbar width

documentHeight

Get the height of the whole page
Returns
number height in px of the document

documentWidth

Get the width of the whole page
Returns
number width in px of the document

scrollTop

Return amount of px scrolled from the top of the document
Returns
number scroll top value in px

scrollLeft

Return amount of px scrolled from the left of the document
Returns
number scroll left value in px

elementOffsetTop

Get the offset top of any DOM element

Parameters


Returns
number the element y position in px

elementOffsetLeft

Get the offset left of any DOM element

Parameters


Returns
number the element x position in px