simple-slider
  • Blog
  • Docs
  • Updates
Docs Menu
  • Examples
    • Custom ease animation
    • Default Sliding Transition
    • Default slider with no options
    • Fading/Opacity transition
    • Full page transition
    • Lightbox Integration
    • Mask Sliding transition
    • Pause slide
    • RequireJS usage
    • Responsive Layout Example
    • Reverse sliding direction
    • Right to left sliding transition
    • Slides containing no image
    • Top to bottom transition
    • Touch swipe example
  • API
simple-slider
  • Blog
  • Docs
  • Updates

Responsive Layout Example Guide

Example using css media queries to achieve a responsive layout with a maxium width value.

View this example

<!doctype html>
<html>
  <head>
    <title>Responsive layout example</title>
    <style>
      .slider { width: 100%; padding-bottom: 25%; }
      .slider img { width: 100%; }
      .wrapper { width: 100%; margin: 0; }
      @media only screen and (min-width: 1024px) {
        .wrapper { width: 1024px; margin: auto; }
      }
    </style>
  </head>
  <body>
    <div class="wrapper">
      <div id="myslider" class="slider">
        <img src="http://placekitten.com/g/1024/256"/>
        <img src="https://unsplash.it/1024/256"/>
        <img src="https://unsplash.it/1024/256?random=1"/>
        <img src="https://unsplash.it/1024/256?random=2"/>
      </div>
    </div>
  </body>
  <script src="https://rawgit.com/ruyadorno/simple-slider/master/dist/simpleslider.min.js"></script>
  <script>
    simpleslider.getSlider({
      container: document.getElementById('myslider'),
      init: -100,
      show: 0,
      end: 100,
      unit: '%'
    });
  </script>
</html>

Contribute on Github! Edit this section.