1.1.0 • Published 7 years ago

oh-hai v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

oh hai

Add class to element once it enters the viewport.

Usage

Include jQuery and ohhai.js:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/js/ohhai.js"></script>

Initialize in your .js file:

$('.fade-on-scroll').ohhai();

// Or change the options
$('.fade-on-scroll').ohhai({
    triggerOffset: 200
    inViewClass: 'visible'
});

Options

OptionTypeDefaultDescription
elTriggerstrtoptop or bottom. The point of the element that determines if it is in the viewport.
triggerOffsetint0Pixel amount that will be scrolled before trigger occurs
inViewClassstr'visible'The class that is added to visible elements.