sliders

by alekskorovin

HTML

<script src="http://flesler.com/jquery/scrollTo/js/jquery.scrollTo-min.js"></script>
<script src="http://demos.flesler.com/jquery/localScroll/js/jquery.localscroll-min.js"></script>
<div class="links" style="position: fixed;">
<a href="#slide-1">Slide 1</a>
<a href="#slide-2">Slide 2</a>
<a href="#slide-3">Slide 3</a>
<a href="#slide-4">Slide 4</a>
<a href="#slide-5">Slide 5</a>
</div>
<div>
<div id="content" style="overflow: hidden;">
<ul>
    <li id="slide-1" style="background: red; width: 120%; text-align: center; font-size: 100px;">Lorem 1</li>
    <li id="slide-2" style="background: blue; width: 120%; text-align: center; font-size: 100px;">Lorem 2</li>
    <li id="slide-3" style="background: green; width: 120%; text-align: center; font-size: 100px;">Lorem 3</li>
    <li id="slide-4" style="background: yellow; width: 120%; text-align: center; font-size: 100px;">Lorem 4</li>
    <li id="slide-5" class="one" style="background: violet; width: 120%; text-align: center; font-size: 100px;">Lorem 5</li>
</ul>
</div>
</div>

CSS

li {
   display: inline-block;
   
}
ul {
    white-space: nowrap;
    
}

JavaScript

$.easing.elasout = function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};


// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	$.localScroll.defaults.axis = 'xy';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#content', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});
$('a').on('click', function() {
    $('#content li:eq(1)').hide();
});
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#content', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});