
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
in-view-utils
Advanced tools
Detect if the dom is within the view, as well as some other dom-related helper functions.
npm i in-view-utils
import {isInDomView} from "in-view-utils"
//like
isInDomView(...)
//like
window.inViewUtils.isInDomView({...})
function name | description | arg | return |
---|---|---|---|
isInDomView | Detects whether the dom is visible inside the container dom | Refer to the isInDomView description | boolean |
isInView | Detects if the dom is fully visible within the window | The dom object being detected | boolean |
getScrollableChildren | Gets one scrollable child node | Refer to the getScrollableChildren description | dom or null |
getDomToVisbleDis | Gets the distance between the dom entering the dom container viewable area | Refer to the isInDomView desc | {x:number,y:number} |
getDomToViewVisbleDis | Gets the distance from the dom to the window viewable | Refer to the getDomToViewVisbleDis description | {x:number,y:number} |
function name | description | arg | return |
---|---|---|---|
getBoundingClientRect | Gets the dom's rect object | dom | rect object |
getRectHeight | Gets the height of the dom rect object, if the label is rotated 90 degrees or -90 degrees, the result is based on the height of the device orientation, no longer a style attribute | dom | number |
getRectWidth | Gets the width of the dom rect object, if the label is rotated 90 degrees or -90 degrees, the result is based on the height of the device orientation, no longer a style attribute | dom | number |
getViewPortHeight | Gets the window height | - | number |
getViewPortWidth | Gets the Window width | - | number |
getBlockWidth | Gets the height of the view after the computed css property, which is a style property in the traditional sense | - | number |
getBlockHeight | Gets the view after the width is calculated after the css property, which is a style property in the traditional sense | - | number |
getBodyScrollY | Gets the body Y-axis scroll | - | number |
getBodyScrollX | Gets the body X axis scroll | - | number |
getDomScrollX | Gets the dom X-axis scroll | dom | number |
getDomScrollY | Gets the dom Y axis to scroll | dom | number |
Detects whether the dom is visible in the parent container dom
typeof arg == object
Get the scrollable elements in the dom, and then return, if not, null
len of arg ===3
A dom or null
Get the distance from the dom to the visual area of the container dom,
typeof arg == object
{
x:number,
y:number
}
Gets the distance from the dom to the window area of the browser window, returns {x:number,y:number} If it is like {x:0,y:0}, it is within the visual area
typeof arg == object
{
x:number,
y:number
}
The difference is only if the container is set to rotate 90 degrees or 90 degrees.
- GetRectHeight is the height obtained by gettingBoundingClientRect
- GetBlockHeight is the height obtained through getComputedStyle.
- GetBoundingClientRect is always based on the orientation of the device, and the result is the orientation of the device above the meaning of the left and right up and down and width and height
- GetComputedStyle simply reads the css styles that are in effect
FAQs
Detect if the dom is within the view, as well as some other dom-related helper functions.
The npm package in-view-utils receives a total of 1 weekly downloads. As such, in-view-utils popularity was classified as not popular.
We found that in-view-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.