1. 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]
bianco.viewport
Package: bianco.viewport
Created by: biancojs
Last modified: Mon, 11 Apr 2022 17:43:11 GMT
Version: 1.1.0
License: MIT
Downloads: 808
Repository: https://github.com/biancojs/viewport

Install

npm install bianco.viewport
yarn add bianco.viewport

bianco.viewport

Build Status
NPM version
NPM downloads
MIT License

Usage

 import viewport from 'bianco.viewport'

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

API

Table of Contents

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code