Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
appear
Advanced tools
Readme
Track the visibility of dom elements and fire user defined callbacks as they appear and disappear.
Be sure to view the documentation on the project page
Include appear.js in your page, it has no dependencies.
Call appear()
passing in an object with the following:
init
function to run when dom is interactive, but before appear.js has started tracking.elements
required function that returns an htmlcollection of elements to track. The dom will be interactive at this point. Can alternatively be an existing htmlcollection instead of a function.appear
function to run when an element is in view, passed the element that has come into view. If defined then appear.js will track elements until they come into view.disappear
function to run when an element goes out of view, passed the element that has gone out of view. If defined then appear.js will track elements until they go out of view.reappear
if true appear.js will keep tracking elements for successfuive appears and dissappears. Default is false.bounds
increase, in pixels, to the threshold size of the element so it can be "viewable" before it is actually in the viewport.debounce
appear.js tracks elements on browser scroll and resize, for performance reasons this check is "debounced" to only happen once for multiple events, 50ms after the last event ends. You can override this value here.deltaSpeed
in addition to debouncing, appear.js will also check for items during continuous slow scrolling, you can controll how slow the scrolling should be via this value. Default is 50 (pixels).deltaTimeout
after a succesful delta speed check, appear.js will not check for viewable items again until this timeout passes. Default is 500 (ms).done
function called when appear.js is no longer tracking any items and event listeners have been removed.appear({
init: function init(){
console.log('dom is ready');
},
elements: function elements(){
// work with all elements with the class "track"
return document.getElementsByClassName('track');
},
appear: function appear(el){
console.log('visible', el);
},
disappear: function disappear(el){
console.log('no longer visible', el);
},
bounds: 200,
reappear: true
});
appear()
will return an object with the following:
trigger()
force a check for viewable elements.pause()
temporarily stop tracking elements.resume()
resume tracking elements.destroy()
permanently stop tracking elements.appear.js logo designed by Magicon from the Noun Project :: Creative Commons - Attribution (CC BY 3.0)
FAQs
utility to run functions when dom elements are visible
The npm package appear receives a total of 1,840 weekly downloads. As such, appear popularity was classified as popular.
We found that appear 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.