Code Monkey home page Code Monkey logo

compass-css-slideshow's Introduction

Compass CSS Slideshow

CSS-only slideshows that work in IE6+, Mozilla and Webkit. Requires progressive JS support to work in Opera.

Based on the work of Jenna Smith

Installation

From the command line:

sudo gem install css-slideshow

Add to a project:

// rails: compass.config, other: config.rb
require 'css-slideshow'

// command line
compass install css-slideshow

Or create a new project:

compass -r css-slideshow -f css-slideshow project_directory

Slideshows

The CSS-Slideshow works with a combination of internal links, overflow and floats.

Each slideshow contains three important elements:

- Container
    - Carousel
        - Slide(s)

You can write the HTML to your liking, but here is one example:

<section class="slideshow"><!-- container -->
  <div><!-- carousel -->

    <article id="slide1">  <!-- slide (repeat as needed) -->
      <!-- slide content -->
    </article>

  </div>
</section>

To go to a slide, all you need is a link from somewhere else on the page that points at that specific slide ID:

<a href="#slide1">a link to the first slide</a>

There's only one mixin that you need, and you apply it to your container:

.slideshow {
  @include slideshow;
}

slideshow takes three optional arguments, each with a default that you can override globaly for your project.

  • The first argument is a selector for the carousel relative to the container. It defaults to "> div".
  • The second is a selector for the slides relative to the carousel. This defaults to "> article".
  • The third is the maximum number of slides that a given slideshow needs to support. It defaults to 10, but you can set it as high or low as you need.

Use them like so:

.slideshow {
  @include slideshow('> div', '> article', 25);
}

Available Defaults

// The selector for your carousel (relative to your container)
$slide-carousel : "> div";

// The selector for your slides (relative to your carousel)
$slide          : "> article";

// The largest number of slides that this container will need to house
$max-slides     : 10;

compass-css-slideshow's People

Contributors

chriseppstein avatar mirisuzanne avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.