AnythingSlider playground
Add, remove, adjust any or all options so you can see how it works.
by Sam_Butler
HTML
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.easing.1.2.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/swfobject.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.fx.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.video.js"></script>
<!-- Add additional stylesheets here -->
<link rel="stylesheet" href="http://css-tricks.github.com/AnythingSlider/css/theme-metallic.css">
<ul id="slider">
<li><section style="background-image: url(http://www.merrehill.co.uk/new/img/dan/grass.jpg); position: relative;"><span style="font-family: sans-serif; font-size: 28px; color: #fff; position: absolute; bottom: 20px; right: 20px;"><h2>Email</h2><p>Everyone loves email</p></span></section></li>
<li><h2>Some text</h2></li>
<li><img src="http://placebear.com/1140/250" alt="" /></li>
<li><img src="http://lorempixel.com/1140/250" alt="" /></li>
<li><img src="http://placedog.com/1140/250" alt="" /></li>
</ul>
<div style="background-color: red; clear:both; width: 1140px; margin: auto;"><p>Some more content</p></div>
<div>
<ul id="testimonials">
<li>Testimonial 1 bla bla bla</li>
<li>Testimonial 2 bla bla bla</li>
</ul>
</div>
CSS
ul#testimonials, ul#testimonials li {
width: 300px;
height: 250px;
list-style: none;
background-color: grey;
}
/*** Set Slider dimensions here! Version 1.7+ ***/
/* added #slider li to make panels the same size in case "resizeContents" is false */
ul#slider, ul#slider li {
width: 1140px;
height: 250px;
list-style: none;
}
/*
AnythingSlider v1.8+ Default theme
By Chris Coyier: http://css-tricks.com
with major improvements by Doug Neiner: http://pixelgraphics.us/
based on work by Remy Sharp: http://jqueryfordesigners.com/
*/
/*****************************
SET DEFAULT DIMENSIONS HERE
*****************************/
/* change the ID & dimensions to match your slider */
#slider {
width: 700px;
height: 390px;
list-style: none;
/* Prevent FOUC (see FAQ page) and keep things readable if javascript is disabled */
overflow-y: auto;
overflow-x: hidden;
}
/******************
SET STYLING HERE
******************
=================================
Default state (no keyboard focus)
==================================*/
/* Overall Wrapper */
.anythingSlider-merrehill {
margin: 0 auto;
/* 45px right & left padding for the arrows, 28px @ bottom for navigation */
padding: 0;
}
/* slider window - top & bottom borders, default state */
.anythingSlider-merrehill .anythingWindow {
border: 0;
}
/* Navigation buttons + start/stop button, default state */
.anythingSlider-merrehill .anythingControls a {
/* top shadow */
background: #777 url(http://css-tricks.github.com/AnythingSlider/images/default.png) center -288px repeat-x;
color: #000;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
}
/* Make sure navigation text is visible */
.anythingSlider-merrehill .anythingControls a span {
visibility: visible;
}
/* Navigation current button, default state */
.anythingSlider-merrehill .anythingControls a.cur {
background: #888;
color: #000;
}
/* start-stop button, stopped, default state...
JavaScript
$('#slider').anythingSlider({
// *********** Appearance ***********
// Theme name; choose from: minimalist-round, minimalist-square,
// metallic, construction, cs-portfolio
theme: 'merrehill',
// Set mode to "horizontal", "vertical" or "fade"
// (only first letter needed); replaces vertical option
mode: 'horizontal',
// If true, the entire slider will expand to fit the parent element
expand: false,
// If true, solitary images/objects in the panel will expand to
// fit the viewport
resizeContents: true,
// Set this value to a number and it will show that many slides at once
showMultiple: false,
// Anything other than "linear" or "swing" requires the easing plugin
easing: "easeInOut",
// If true, builds the forwards and backwards buttons
buildArrows: true,
// If true, builds a list of anchor links to link to each panel
buildNavigation: false,
// If true, builds the start/stop button
buildStartStop: false,
// Append forward arrow to a HTML element
// (jQuery Object, selector or HTMLNode), if not null
appendFowardTo: null,
// Append back arrow to a HTML element
// (jQuery Object, selector or HTMLNode), if not null
appendBackTo: null,
// Append controls (navigation + start-stop) to a HTML element
// (jQuery Object, selector or HTMLNode), if not null
appendControlsTo: null,
// Append navigation buttons to a HTML element
// (jQuery Object, selector or HTMLNode), if not null
appendNavigationTo: null,
// Append start-stop button to a HTML element
// (jQuery Object, selector or HTMLNode), if not null
appendStartStopTo: null,
// If true, side navigation arrows will slide out on
// hovering & hide @ other times
toggleArrows: false,
// if true, slide in controls (navigation + play/stop button)
// on hover and slide change, hide @ other times
toggleControls: false,
// Start button text
...