<ul class="nav">
<li class="thumb1"><a href="#panel1" title="Panel 1">Panel 1</a></li>
<li><a href="#panel2">Panel 2</a></li>
<li><a href="#panel3">Panel 3</a></li>
</ul>
<div class="panels">
<div class="slider">
<div id="panel1">
<p>From this day forward, Flight Control will be known by two words: 'Tough' and 'Competent.' </p>
<p>It's just mind-blowingly awesome. I apologize, and I wish I was more articulate, but it's hard to be articulate when your mind's blown—but in a very good way.</p>
</div>
<div id="panel2">
<p>From this day forward, Flight Control will be known by two words: 'Tough' and 'Competent.' Tough means we are forever accountable for what we do or what we fail to do. We will never again compromise our responsibilities. </p>
<p>Every saint and sinner in the history of our species lived there--on a mote of dust suspended in a sunbeam.</p>
</div>
<div id="panel3">
<p>These words are the price of admission to the ranks of Mission Control.</p>
<p>It's just mind-blowingly awesome. I apologize, and I wish I was more articulate, but it's hard to be articulate when your mind's blown—but in a very good way.</p>
</div>
</div>
</div>
//Slider
//object containing margin settings
var margins = {
panel1: 0,
panel2: -500,
panel3: -1000
}
//handle nav click
$(".nav a").click(function(e){
//stop browser default
e.preventDefault();
//remove on states for all nav links
$(".nav a").removeClass("on");
//add on state to selected nav link
$(this).addClass("on");
//set margin of slider to move
$(".slider").animate({
marginLeft: margins[$(this).attr("href").split("#")[1]]
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.