Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
on-intersect
Advanced tools
Call back when an element intersects with another.
var intersectExists = require('on-intersect/exists')
var onViewport = require('on-intersect')
var html = require('bel')
var el = html`
<h1 style="color: white">
BEHOLD THE GOBLIN!
</h1>
`
var main = html`
<main>
<div style="height: 110vh"></div>
${el}
<div style="height: 110vh"></div>
</main>
`
document.body.appendChild(main)
// observers should only be added _after_ the element is rendered on the DOM,
// else it displeases the browser emperors and they _will_ warn you
if (intersectExists()) {
var stopObserving = onIntersect(el, onEnter, onExit)
}
function onEnter (entry) {
console.log(entry.time)
console.log(entry.rootBounds)
console.log(entry.intersectionRect)
console.log(entry.intersectionRatio)
console.log(entry.target)
document.body.setAttribute('style', 'background-color: green')
}
function onExit (entry) {
document.body.setAttribute('style', 'background-color: white')
stopObserving()
}
Call a callback when an element intersects with another. Defaults to
document.body
. The first argument can either be an HTML Node or an object. If
it's an object it must contain a target
which is an HTML node. Options can be:
"10px 20px 30px 40px"
(top, right, bottom, left). If the
root element is specified % values can be used.onEnter
every time
the threshold is passed. threshold
defaults to 1.Unregister the observer
Check if window.InterSectionObserver
exists
$ npm install on-intersect
FAQs
Call back when an element intersects with another
The npm package on-intersect receives a total of 8 weekly downloads. As such, on-intersect popularity was classified as not popular.
We found that on-intersect 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.