Skip to content

cresjie/viewedByScroll.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

viewedByScroll.js

listens to scrolling event and returns the element(s) viewed by scroll.

Requirements

jQuery 1.7 or later

Installation


Step 1: Link required files

jQuery library need to be included.Next,include viewedByScroll.js
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="viewedByScroll.js"></script>

Step 2: Call the viewedByScroll

$(document).ready(function(){
	//select element(s) to check by the scrolling event
	$('.viewedByScroll').viewedByScroll({indentTop:0},function(index,element){
		///codes
	})

});

Documentation

###.viewedByScroll(settings,callback);


settings [object] configures settings. See .settings()

callback [function] triggers callback when the element is viewed in the viewport. Pass an element and its index

###.settings(object) configures settings

	top distance from the viewport
	indentTop: 0 //default
	

About

listens to scrolling event and returns the element in the viewport

Resources

License

Stars

Watchers

Forks

Packages

No packages published