What I Believe3
by Koubenec
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Better Coda Slider</title>
<link rel="stylesheet" href="coda-slider.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="http://www.marcatectura.com/wp-content/jquery-1.2.6.js" type="text/javascript"></script>
<script src="http://www.marcatectura.com/wp-content/jquery.scrollTo-1.3.3.js" type="text/javascript"></script>
<script src="http://www.marcatectura.com/wp-content/jquery.localscroll-1.2.5.js" type="text/javascript" charset="utf-8"></script>
<script src="http://www.marcatectura.com/wp-content/jquery.serialScroll-1.2.1.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="wrapper">
<div id="intro">
This area can house any content within the wrapper prior to the actual slider, but is best left empty for the Adrienne Adams feature.
</div>
<div id="slider">
<div class="scroll">
<div class="scrollContainer">
<div class="panel" id="wib1">wib1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor<a href="#editor">Editor</a>incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div class="panel" id="files"><h2>Files</h2><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation...
CSS
body {
margin: 0px;
padding: 0;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 100%;
color: #ffffff;
background-color: #414042;
}
#wrapper {
width: 100%;
margin-left: auto;
margin-right: auto;
}
#intro {
padding-bottom: 0px;
}
h2 {
margin: 0;
margin-bottom: 14px;
padding: 0;
}
#slider {
width: 100%;
margin-left: auto;
margin-right: auto;
position: relative;
}
.scroll {
height: 250px;
width: 70%;
padding: 0px 0px 0px 0px;
margin-left: auto;
margin-right: auto;
overflow: auto;
overflow-x: hidden;
position: relative;
clear: left;
background: #231F20;
}
.scrollContainer div.panel {
margin-left: auto;
margin-right: auto;
padding: 20px 20px 20px 20px;
height: 210px;
width: 100%;
}
#shade {
color: red;
height: 0px;
}
ul.navigation {
list-style: none;
margin: 0;
padding: 0;
padding-bottom: 9px;
}
ul.navigation li {
display: inline;
margin-right: 10px;
}
ul.navigation a {
padding: 10px;
color: #000;
text-decoration: none;
}
ul.navigation a:hover {
background-color: #f6f6f6;
}
ul.navigation a.selected {
background-color: #fff;
}
ul.navigation a:focus {
outline: none;
}
.scrollButtons {
position: absolute;
top: 150px;
cursor: pointer;
}
.scrollButtons.left {
left: -20px;
display: none;
}
.scrollButtons.right {
right: -20px;
display: none;
}
.hide {
display: none;
}
JavaScript
// when the DOM is ready...
$(document).ready(function () {
var $panels = $('#slider .scrollContainer > div');
var $container = $('#slider .scrollContainer');
// if false, we'll float all the panels left and fix the width
// of the container
var horizontal = false;
// float the panels left if we're going horizontal
if (horizontal) {
$panels.css({
'float' : 'left',
'position' : 'relative' // IE fix to ensure overflow is hidden
});
// calculate a new width for the container (so it holds all panels)
$container.css('width', $panels[0].offsetWidth * $panels.length);
}
// collect the scroll object, at the same time apply the hidden overflow
// to remove the default scrollbars that will appear
var $scroll = $('#slider .scroll').css('overflow', 'hidden');
// apply our left + right buttons
$scroll
.before('<img class="scrollButtons left" src="images/scroll_left.png" />')
.after('<img class="scrollButtons right" src="images/scroll_right.png" />');
// handle nav selection
function selectNav() {
$(this)
.parents('ul:first')
.find('a')
.removeClass('selected')
.end()
.end()
.addClass('selected');
}
$('#slider .navigation').find('a').click(selectNav);
// go find the navigation link that has this target and select the nav
function trigger(data) {
var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
selectNav.call(el);
}
if (window.location.hash) {
trigger({ id : window.location.hash.substr(1) });
} else {
$('ul.navigation a:first').click();
}
// offset is used to move to *exactly* the right place, since I'm using
// padding on my example, I need to subtract the amount of padding to
// the offset. Try removing this to get a good idea of the...