Browse Source

messing with the slider

pull/253/head
connors 11 years ago
parent
commit
9ab03fb5a5
  1. 32
      components.html
  2. 7
      dist/ratchet.css
  3. 4
      dist/ratchet.js
  4. 6
      docs-assets/css/docs.css
  5. 4
      lib/js/sliders.js
  6. 6
      lib/sass/docs.scss
  7. 7
      lib/sass/sliders.scss

32
components.html

@ -994,35 +994,35 @@ document
<div class="component-example component-example-fullbleed"> <div class="component-example component-example-fullbleed">
<div class="slider" id="mySlider"> <div class="slider" id="mySlider">
<ul> <div class="slides">
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-1.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-1.jpg">
<span class="slide-text">&larr; Slide me</span> <span class="slide-text">&larr; Slide me</span>
</li> </div>
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-2.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-2.jpg">
</li> </div>
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-3.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-3.jpg">
</li> </div>
</ul> </div>
</div> </div>
</div> </div>
{% highlight html %} {% highlight html %}
<div class="slider" id="mySlider"> <div class="slider" id="mySlider">
<ul> <div class="slides">
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-1.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-1.jpg">
<span class="slide-text">&larr; Slide me</span> <span class="slide-text">&larr; Slide me</span>
</li> </div>
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-2.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-2.jpg">
</li> </div>
<li> <div class="slide">
<img src="{{ page.base_url }}docs-assets/img/slide-3.jpg"> <img src="{{ page.base_url }}docs-assets/img/slide-3.jpg">
</li> </div>
</ul> </div>
</div> </div>
{% endhighlight %} {% endhighlight %}

7
dist/ratchet.css vendored

@ -1036,14 +1036,13 @@ input[type="button"] {
.slider, .slider,
.slider > li { .slider > li {
width: 100%; width: 100%;
height: 200px;
} }
.slider { .slider {
overflow: hidden; overflow: hidden;
background-color: #000; background-color: #000;
} }
.slider > ul { .slider .slides {
position: relative; position: relative;
padding: 0; padding: 0;
font-size: 0; font-size: 0;
@ -1051,13 +1050,13 @@ input[type="button"] {
-webkit-transition: all 0 linear; -webkit-transition: all 0 linear;
transition: all 0 linear; transition: all 0 linear;
} }
.slider > ul > li { .slider .slides .slide {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.slider > ul > li > * { .slider .slides .slide > * {
font-size: 14px; font-size: 14px;
} }

4
dist/ratchet.js vendored

@ -600,7 +600,7 @@
var scrollableArea; var scrollableArea;
var getSlider = function (target) { var getSlider = function (target) {
var i, sliders = document.querySelectorAll('.slider > ul'); var i, sliders = document.querySelectorAll('.slider > .slides');
for (; target && target !== document; target = target.parentNode) { for (; target && target !== document; target = target.parentNode) {
for (i = sliders.length; i--;) { if (sliders[i] === target) return target; } for (i = sliders.length; i--;) { if (sliders[i] === target) return target; }
} }
@ -624,7 +624,7 @@
if (!slider) return; if (!slider) return;
var firstItem = slider.querySelector('li'); var firstItem = slider.querySelector('.slide');
scrollableArea = firstItem.offsetWidth * slider.children.length; scrollableArea = firstItem.offsetWidth * slider.children.length;
isScrolling = undefined; isScrolling = undefined;

6
docs-assets/css/docs.css

@ -594,11 +594,13 @@ hr {
opacity: 1; opacity: 1;
} }
.slider li img { .slider .slide img {
width: 100%; width: 100%;
height: 570px;
display: block;
} }
.slider .slide-text { .slider .slides .slide-text {
position: absolute; position: absolute;
top: 45%; top: 45%;
left: 0; left: 0;

4
lib/js/sliders.js

@ -22,7 +22,7 @@
var scrollableArea; var scrollableArea;
var getSlider = function (target) { var getSlider = function (target) {
var i, sliders = document.querySelectorAll('.slider > ul'); var i, sliders = document.querySelectorAll('.slider > .slides');
for (; target && target !== document; target = target.parentNode) { for (; target && target !== document; target = target.parentNode) {
for (i = sliders.length; i--;) { if (sliders[i] === target) return target; } for (i = sliders.length; i--;) { if (sliders[i] === target) return target; }
} }
@ -46,7 +46,7 @@
if (!slider) return; if (!slider) return;
var firstItem = slider.querySelector('li'); var firstItem = slider.querySelector('.slide');
scrollableArea = firstItem.offsetWidth * slider.children.length; scrollableArea = firstItem.offsetWidth * slider.children.length;
isScrolling = undefined; isScrolling = undefined;

6
lib/sass/docs.scss

@ -633,10 +633,12 @@ hr {
top: 72px; top: 72px;
opacity: 1; opacity: 1;
} }
.slider li img { .slider .slide img {
width: 100%; width: 100%;
height: 570px; // Fullscreen fun times
display: block;
} }
.slider .slide-text { .slider .slides .slide-text {
position: absolute; position: absolute;
top: 45%; top: 45%;
left: 0; left: 0;

7
lib/sass/sliders.scss

@ -2,11 +2,10 @@
// Slider styles (to be used with sliders.js) // Slider styles (to be used with sliders.js)
// -------------------------------------------------- // --------------------------------------------------
// Width/height of slider // Width of slider
.slider, .slider,
.slider > li { .slider > li {
width: 100%; width: 100%;
height: 200px;
} }
// Outer wrapper for slider // Outer wrapper for slider
@ -15,7 +14,7 @@
background-color: #000; background-color: #000;
// Inner wrapper for slider (width of all slides together) // Inner wrapper for slider (width of all slides together)
> ul { .slides {
position: relative; position: relative;
padding: 0; padding: 0;
font-size: 0; // Remove spaces from inline-block children font-size: 0; // Remove spaces from inline-block children
@ -23,7 +22,7 @@
@include transition(all 0 linear); @include transition(all 0 linear);
// Individual slide // Individual slide
> li { .slide {
display: inline-block; display: inline-block;
vertical-align: top; // Ensure that li always aligns to top vertical-align: top; // Ensure that li always aligns to top
width: 100%; width: 100%;

Loading…
Cancel
Save