🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

onload

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onload

Onload transitions

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

onload

Add onload transitions to DOM elements that emit "load" events such as images by adding ".preload" and ".onload" classnames accordingly.

Installation

$ component install component/onload

Example

Example js:

var onload = require('onload');
var img = document.querySelector('img');
onload(img);

Example css:

img {
  opacity: 1;
  -webkit-transition: opacity 300ms;
  -moz-transition: opacity 300ms;
  transition: opacity 300ms;
}

img.preload {
  opacity: 0;
}

API

  • onload(el)

Images

Images which are .complete are immediately assigned ".onload" so that effects can be applied to non-cached images only.

License

MIT

FAQs

Package last updated on 11 Apr 2013

Did you know?

Socket

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.

Install

Related posts