Socket
Book a DemoInstallSign in
Socket

oh-hai

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oh-hai

Add class to images when they enter the viewport

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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.

Keywords

viewport

FAQs

Package last updated on 29 Dec 2016

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