Slider (Transdev) DEV 0.1
by moob
HTML
<div id="aParent">
<div class="slyduh">
<ul>
<li style="background-image:url('http://lorempixel.com/400/200/')">
<h2 class="slide-in-from-left">1</h2>
<h3 class="slide-in-from-bottom">jhjhj</h3>
</li>
<li style="background-image:url('http://lorempixel.com/400/300/')">
<div id="bigger" class="slide-in-from-top">
2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2 inner 2</div>
</li>
<li style="background-image:url('http://lorempixel.com/400/400/')"><h2 class="slide-in-from-right">3</h2></li>
</ul>
</div>
<header><h1>Imagine there's an element <em>inside</em> the slider...</h1>
<p>This content that may be required to hold the slider open.</p>
</header>
</div>
<div style="margin:20px">
<h3>Responsive background slider thing</h3>
<p>Settings</p>
<code>
loop : true, //endless looping next/prev (boolean)<br />
transitionSpeed : 600, //animation speed (milliseconds)<br />
cycle : 6000, //automatically cycle through slides (pauses on hover). Delay in milliseconds (0 = no cycling)<br />
startPosition : 0, //Starting Slide Index (zero index)<br />
complete : null //function callback on complete<br />
</code>
<p><strong>Animated slide text</strong><br />
Your text can be animated when the slide comes into view. Style and position the elements as you like then apply one of the following classnames. Don't edit the '.slide-in-from-' styles.</p>
<code>
.slide-in-from-left
.slide-in-from-right
.slide-in-from-top
.slide-in-from-bottom
</code>
</div>
CSS
html, body {
margin:0;
}
header {
width:60%;
margin:auto;
border:1px dotted white;
color:#ddd;
z-index:1;
}
header:hover {
height:300px;
border-color:yellow;
}
.slyduh {
width: 100%;
min-width:100%;
max-width:100%;
max-height:100%;
overflow:hidden;
position:relative;
z-index:0;
}
.slyduh.fill {
display:block; top:0; right:0; bottom:0; left:0;
overflow:hidden;
position:absolute;
z-index:-1;
height:100%; min-height:100%;
border:0px solid red;
}
.slyduh.fill ul {
display:block; top:0; right:0; bottom:0; left:0;
position:absolute;
height:100%; min-height:100%;
}
.slyduh.fill ul li {
height:100%; min-height:100%;
}
.slyduh ul {
list-style: none;
margin: 0;
padding: 0;
position: relative;
width: 10000%;
display:block;
}
.slyduh ul > li {
display:inline-block;
position:relative;
margin-right:-4px;
width:1%;
font-size: 30px;
text-align: center;
vertical-align:top;
height:100%;
max-height:100%;
background: #666666 repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
color:black;
text-shadow:0px 0px 10px white;
overflow:hidden;
}
.slyduh-nextButton, .slyduh-prevButton {
display:block;
position:absolute;
height:50px;
z-index:100;
top:0;
bottom:0;
margin:auto;
right:-1px;
background:rgba(255, 255, 255, .6);
border-radius:5px 0 0 5px;
width:80px;
text-align:center;
line-height:50px;
border:1px solid white;
box-shadow:0px 0px 3px 2px rgba(0, 0, 0, .5);
}
.slyduh-prevButton {
right:auto;
left:-1px;
border-radius:0 5px 5px 0;
}
.slyduh-nextButton:hover, .slyduh-prevButton:hover {
background-color:rgba(25,255,255,.5)
}
.slyduh-dots {position:absolute; top:0; left:0; right:0; margin:auto; text-align:center; z-index:999;}
.slyduh-dots a...
JavaScript
/* touch events DEV*/
(function ($) {
$.fn.touchListener = function (options) {
var settings = $.extend({
complete: null //function callback on complete
}, options);
return this.each(function () {
var el = $(this);
console.log(el);
el.on('touchstart, mousedown', function(e){
//$(this).addClass('touchstart');
console.log('touchstart');
});
el.on('hover', function(e) {
console.log('mouseover');
});
el.on('touchmove, mousemove', function(e) {
//$(this).addClass('touchmove');
console.log('touchmove');
e.preventDefault();
//var ev = e.originalEvent;
//console.log(ev.touches);
})
.on('touchend, mouseup', function(e){
//$(this).addClass('touchend');
console.log('touchend');
e.preventDefault();
// $(this).removeClass('touchstart touchmove touchend');
});
});
};
}(jQuery));
/*
a background-image slider
*/
(function ($) {
$.fn.slyduh = function (options) {
// default settings
var settings = $.extend({
fillMode: 'flexfill', //fill (fill parent) || flex (adaptive to fits content) || fit (all scaled to match largest slide)
transitionSpeed: 600, //ms (should speed should be uniform like MPH or the time taken to do one transition?)
cycle: 6000, //Should it automatically move to next slide? 0=off, 6000 = every 6 seconds
startPosition: 0, //startingSlide (zero index)
loop: false,
complete: null //function callback on complete
}, options);
return this.each(function () {
var slider = $(this),
parent = slider.parent(),
cassette =...