Skip to content

miWebb/jQuery.fragmentScroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery.fragmentScroll

The jQuery fragment scroll plugin replaces the default fragment link behavior with a scroll animation. The plugin only works for descendants of the given element(s). Check the demo for more information.

Example

HTML

<!doctype html>
<html>
	<body>
		<div id="nav">
			<p><a href="#fragment">Content</a></p>
		</div>
		<div id="fragment">
			<p>Footer</p>
		</div>
	</body>
</html>

Javascript

$(window).load(function() {
	$('body').fragmentScroll();
});

Options

$('body').fragmentScroll({
	// The frame that will scroll if the content overflows the elements box. (body for webkit browsers)
	frame: 'html, body',

	// The offset from the top of the element.
	offset: 0,

	// The animation time in microseconds.
	speed: 1000,

	// Animation effect. (http://www.easings.net)
	easing: 'swing'

	// Enable fragment in URL.
	enableFragment: false,

	// Enable animation chain. The browser will execute all the events in stead of ignoring event during animation.
	enableAnimationChain: false,

	// Call function on start.
	onStart: function() {},

	// Call function on complete.
	onComplete: function() {}
});