Skip to content

lukelex/fader.js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

#fader.js

Fader.js is a stand-alone (no dependencies) micro js that implementes the fade-in and fade-out effect on html elements. It attempts a CSS3 transition, and if not supported, degrades to a JS based animation.

##Usage ###Basics You can either let Fader find the element, through:

// "elemId" => the id of the element to be faded out
// 5        => the animation duration
Fader.fadeOutWithId("elemId", 5);

// "elemId" => the id of the element to be faded in
// 3        => the animation duration
Fader.fadeInWithId("elemId", 3);

// "elemClass" => the class of the element to be faded out
// 0           => the element index, in the retrieved objects, to be faded
// 4           => the animation duration
Fader.fadeOutWithClass("elemClass", 0, 4);

// "elemClass" => the class of the element to be faded in
// 1           => the element index, in the retrieved objects, to be faded
// 2           => the animation duration
Fader.fadeInWithClass("elemClass", 1, 2);

Or, find the element your self and pass it to Fader, through:

// elem => the element to be faded in
// 6    => the animation duration
Fader.fadeInElement(elem, 6);

// elem => the element to be faded out
// 1    => the animation duration
Fader.fadeOutElement(elem, 1);

You can use even callback functions that fires after fade effect:

Fader.fadeOutElement(elem, 0.5, function(){
  elem.style.display = 'none';
});

##TO DO

  • Fade passing an element; [DONE]
  • Support collections.

##Contributors

##License Copyright (c) 2012 Lukas Alexandre.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy and modify copies of the Software, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A micro js that implements the fader transition effect without any other library.

Resources

Stars

Watchers

Forks

Packages

No packages published