Giter Site home page Giter Site logo

responsive-carousel's Introduction

โš ๏ธ This project is archived and the repository is no longer maintained.

Responsive Carousel

Filament Group

A jQuery-based script for responsive carousels that work with mouse, touch, and keyboard

Getting Started

Install using npm using:

npm install responsive-carousel

This will create a copy of the project in your node_modules folder.

Or get the production version (.min.js) or the development version (.js) from the releases page. Click the dist-<version>.tar.gz download.

In your web page:

<script src="jquery.js"></script>
<script src="dist/responsive-carousel.min.js"></script>
<link href="src/responsive-carousel.css" rel="stylesheet">

<div class="carousel">
	<div>
		<!-- carousel item content here -->
	</div>
	<div>
		<!-- carousel item content here -->
	</div>
</div>

The default build includes the slide/drag transition that you can apply by adding a data attribute and including some additional CSS.

<script src="jquery.js"></script>
<script src="dist/responsive-carousel.min.js"></script>
<link href="src/responsive-carousel.css" rel="stylesheet">
<link href="src/responsive-carousel.slide.css" rel="stylesheet">

<div class="carousel" data-transition="slide">
	<div>
		<!-- carousel item content here -->
	</div>
	<div>
		<!-- carousel item content here -->
	</div>
</div>

Extended features

There are other extensions in the src folder, such as flip and fade transitions, autoplay, keyboard handling, pagination, and more. If you'd like to create a build that includes certain extensions, just add them to the JS files listed under concat in the Gruntfile.js file, and run grunt from a command line.

Demos

Check out the test/functional/ directory for demos.

Documentation

Preventing Content Looping

The default carousel (responsive-carousel.js) returns to the initial active item(s) once it reaches the end of its list. This behavior can be disabled by annotating the carousel DOM element with data-loop='false' and including responsive-carousel.loop.js directly after the core carousel JS. For example:

...
<script src="path/to/responsive-carousel.js"></script>
<script src="path/to/responsive-carousel.loop.js"></script>
...

<div class="carousel" data-loop="false">
  <div>
    <img src="...">
  </div>

  ...
</div>

Then, after both the carousel and plugin have loaded you can initialize as normal.

$( ".carousel" ).carousel();

When the carousel reaches the end or beginning of the list, the inserted navigation links (a.next and a.prev) will be decorated with an additional disabled class. This class receives no properties from the library by default.

For a demo see test/functional/no-loop.html.

Set the Carousel Speed

To declaratively set the speed of the carousel, add a data-interval to the carousel container with a value set in milliseconds.

<!-- set the carousel to change every 5 seconds -->
<div class="carousel" data-autoplay data-interval="5000">
  <div>
    <img src="...">
  </div>
  ...
</div>

For a demo see test/functional/flip-auto.html .

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!

License

Copyright (c) 2015 Filament Group, Inc. Licensed under the MIT, GPL licenses.

responsive-carousel's People

Contributors

0xadada avatar aarongustafson avatar bpscott avatar greenkeeperio-bot avatar jefflembeck avatar johnbender avatar matthewbeta avatar scottjehl avatar tnguyen14 avatar wilto avatar yoavweiss avatar zachleat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

responsive-carousel's Issues

Build process failing

I downloaded the repo and without changing anything, when I run grunt, I got the following error:

Running "lint:files" (lint) task
Lint free.

Running "qunit:files" (qunit) task
Testing responsive-carousel.html
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Plugin architecture question

I'm curious why Responsive Carousel initializes automatically rather than being attached to a jQuery selector and receiving a config object.

It's a little confusing not being able to set all properties within JS, and having to edit CSS to change the transition duration. This seems to limit how diversely the plugin can be used within a single site.

Navigation not working in IE7

Prev and Next buttons aren't working in IE7. When you click on the next button, it appends #next to the URL and does nothing.

transitionend doesn't fire in IE

Dear Sirs,

Thank-you for your enjoyable carousel. I've run into an issue in Microsoft Internet HTML Viewing Software (IE9). Though it seems to think it supports CSS transitions, it doesn't fire the transitionend event. So when in 'slide' mode it goes to the next slide, but the classes don't get re-assigned with the _transitionEnd method.

My hack (ln 117 of source):

if ($.browser.msie){
$self[ pluginName ]("_transitionEnd", $from, $to, reverseClass);
}

...I know you'll barf; but it works for now. Any idea on how to 'force' IE to call the event?

Location of JS scripts

Do these have to be in the header? It doesn't work if you put the JS scripts in the footer (which is the ideal location)

trigger next/prev outside of carousel wrapper?

Sorry for not being able to figure this out. Scripting does not come to me as easily as I would like so any help would be greatly appreciated!!!

Is it possible to trigger the 'next' and 'prev' via a data-attribute on a static element or through an API call? I apologize again if my understanding and terminology are not correct.

Right now I am just hiding the 'carousel-nav' element and 'triggering' a 'click' event via clicking on links elsewhere in my site:

$('.work-prev').on('click', function(e){
    $('.carousel-nav .prev').trigger('click');
    e.preventDefault();
});
$('.work-next').on('click', function(e){
    $('.carousel-nav .next').trigger('click');
    e.preventDefault();
});

This feels dirty tho and figure there is a more elegant way via the plugin :-p

Any help for a jQuery Padawan would be greatly appreciated!!!

Pagination not showing up

First of all.. thanks for developing this great carousel script!

I cant get the pagination to work. It does not show up.
I have tried using the distribution file, and I have also tried loading the files separately. Neither works. I thought the error was on my end until i cloned the entire repo and checked "functional/pagination.html". The pagination is not showing up here either.

Here is my html:
http://jsfiddle.net/Ldarb/

Can anyone figure out whats going on?
The pagination is obviously working fine at http://filamentgroup.github.io/responsive-carousel/test/functional/pagination.html

Chrome 21 (windows 7) -webkit-transform: translate3d performance hit

I'm not sure of the reasoning for the translate3d (is it supposed to enable 3d transform hardware support?), but on my windows 7 box, with plenty of ram and processing power, that CSS property is making any page resizing VERY jittery.

This might be a performance issue that'll be resolved in chrome 22, but for now it's quite a painful bug.

Carousel - Transparent background

Any fix available so transparent backgrounds can be used for the Carousel without seeing the previous slide transition behind the active slide?

Any help would be greatly appreciated.

Stop autoplay on touch events

With the autoplay extension active, the touch events do not stop the autoplay from advancing the slides. Through a quick look at the code, it looks like this issue could be solved in two different ways depending on what flavor the code should have. The autoplay already has a binding for mousedown to call the autoplay stop function, so either the binding in the autoplay code could be expanded to include a touchstart event, or the touch code could trigger a mousedown event.

Position nav outside of carousel container

Is it possible to position the nav outside the carousel container so we don't have to worry about the effects of overflow: hidden hiding the nav links if we position them outside the container?

Dynamic Containers scroll by one

When I have 3 elements visible in the dynamic container at once, pressing next or previous will show me the next/prev set of 3. Is there a way to have the carousel advance by just 1 element?

Issue with 2 carousel in a page

If there are 2 carousels in a page, one specifying data-transition and the second one does not, the second one will overwrite this setting for the first one, as cssTransitionsSupport is currently a global property.

Perhaps cssTransitionsSupport could be an instance specific variable to a specific carousel?

Text only slide

Wondering if anybody has tried using this carousel with a text only slide.

In my testing when moving to the next item I see the text from the previous slide fly off to the left (expected behaviour) but then slides back behind the new item and flies off to the right.

feature request: num slides shown and num slides moved

hi, great script, as always. thanx a lot!

how about options to specify the number of slides being shown and number of slides being moved?
for instance, so you can show always 3 slides but move one slide at a time.

bonus points for being able to use CSS stiles for the slides, not recalculated in the script.
extra bonus points for being able to choose if active slide is the one in the middle or the first one visible.

Adding second carousel dynamically

Howdy... adding a second a carousel to the page (jquery load HTML file with the carousel markup)... works except none of the extensions work. How to/work around?

I can "do" this (after the HTML has completed loading)... $carousel.carousel("_createPagination");
But a) is that the best way? b) touch/drag?

Active pagination issue

When using pagination and have multiple carousels on a page and click on the first carousel's next/prev arrow all the pagination items update for each carousel and so they become out of sync with the carousel it is bound to.

Feature Request - Load Images On Demand

Any plans to include on-demand image loading in future releases? Instead of loading ALL carousel images, it would be wonderful if the images were loaded based on user interaction.

This has always been a sticking point with responsive carousels (such as Flexslider).

IE9 rotations stop after the first element

On IE9 I'm using <div><img></div> for my carousel but after the first image rotates it stops at the second image and won't go any further. I looked at your demo's as well in IE9 and the same issue. Specifically I'm using the Fade with Autoplay. Thought I'd bring this up and see if it is a bug.

If Prev/Next buttons are positioned at the top of the slider--- all responsive functionality breaks

When we enabled the dynamic-containers plugin, we noticed that as we changed window sizes, the functionality will completely break if the prev and next buttons are at the same height as the first element. This is due to the '$( this ).offset().top !== prev.offset().top' being the same as the prev. and next buttons are within the same div.

Although I think this can be solved by CSS, this might not be desirable if the design wants the buttons to be up top. Could also be helpful to have the previous and next buttons outside of the container, and just have the first element be automatically added to the first container no matter what.

Scrolling in Increments

Should allow you to set carousel to scroll in increments. I would like to scroll only by one image at a time.
I using the dynamic responsive carousel

Mistake in CSS transition detection

"-ms-transition" in document.documentElement.style returns false, not undefined in IE9, so the script thinks that IE9 supports CSS transitions.

This is what causes #19.

Carousel is now working with dynamically loaded contents

I was trying to load content from database in a div on click of some categories.

The issue is, content is loading properly but carousel is not working.

I mean the next & prev navigation is gone and all the content is loading in the div, instead of appearing in a single row it's appearing in multiple rows.

Please let me know if I am doing something wrong.

Thanks

Rendering error in Chrome / vertical white lines

I am using a pretty vanilla implementation of responsive carousel:

                        <div class="carousel" data-transition="slide">
                            <img src="img/news-test2.jpg" />
                            <img src="img/news-test.jpg" />
                        </div>

A colleague of mine sees vertical white lines on the image after clicking the "next slide" button.

White lines

He uses Mac OS 10.5.8 and chrome version 21.0.1180.90 on a MacBook Pro (15-inch, Late 2008).

I cannot reproduce the error on any other machines. Any ideas what it could be?

CssTransitionSupport returns false for ie10

In ie10 cssTransitionSupport is returning false. In ie10, it looks like it has Mstransition rather than MsTransition in document.documentElement.style.

Also, I might be wrong about this, but it looks like that function doesn't check for a non prefixed version of transition support.

Animation needs to be invisible after click

Is it possible you can fix the bug that happens when you have transparent background so your animation "behind the scene" slides to the right through all the elements... I use your slider with text as a news ticker, but i need transparent background and thats not possible with this way the animation works...

Number of children per carousel item different in your demo of responsive-containers.html from the supplied code

Your responsive containers are exactly what I need to finish a project but the version of responsive-containers.html in your repository behaves differently from your online version in that the div.slag is not the child but the parent carousel-item in the download version. what do i have to do to make div.slag the child and set a parent div so that the scripting will detect the number of children and change them accordingly. I've tried adding a default parent div around every 4 of my equivalents of div.slag but they aren't then removing the 2nd row when I reduce the size. What am i doing wrong? I have the responsive widths right for the child elements. I have tried looking on firebug and comparing the code but must be missing something crucial cheers

Pagination bug

When data-transition="slide" is used together with data-paginate the pagination links stop working after clicking the same link two times in a row.
http://jsfiddle.net/rSaLL/1/

When data-transition="fade" is used layout bugs occur when clicking the same link two times in a row.
http://jsfiddle.net/rSaLL/

This occurs in Safari 6, Chrome 21.0.1180.82 and Firefox 14.0.1 on Mac OS 10.8.

Chrome issue with using the gallery Dynamic-containers

I hope I explain this issue correctly! I'm wanting to create a gallery like that of repsonsive-containers.
When I view the gallery on Chrome browser all the images brake out of there horizontal display like this:
Picture 1

Instead of displaying like this has they should in the browser window:
Picture 2

This is only happens on the Chrome browser. Also when I resize the Chrome browser window the images fall or click into there correct way of displaying i.e (the second image show on this post) when I resize the browser window. Anybody know why this is happening on the chrome browser? Thanks in advance.

Bugs apparent with longer slide duration

Testing with longer slide transitions (1.0s) I noticed a few bugs.

  1. The underlying slides are visible in the background. It would be good to have a default background set like:

    .carousel .carousel-item { background:#FFF; }

  2. If the slides are different heights the slide animation starts and ends, then the height is updated instantly. The "underlying slides" are visible changing positions in the background. I'd prefer if the carousel initially took the height of the tallest slide, or at least hid the background slides while the height was changing.

  3. Using the 'Previous' nav button, there is a small delay before the transition activates in reverse. The "height bug" shows the behavior clearly. The former slide must transition to its new position in the background before the "visible" animation can begin. It would be better to skip this step.

responsive container demo is wonky

test/functional/responsive-containers.html

behaves really strangely. Why is only one image loaded into the carousel to start? And why are extra images darting on and off screen at the right on the transition events?

Big kudos for the attention to keyboard and touch events, but at the moment this doesn't have anything approaching the customizability of carousels built with cycle2, which I would need for any production work...

Arrows visibility is incorrect with multiple instances on the page

Arrows visibility is incorrect with multiple instances on the page. Using example-1.html, add identical markup with id's #example-2, #example-3

and wire in the component in the exact same way

$("#example-2")
.responsiveCarousel

$("#example-3")
.responsiveCarouse...

arrows states are incorrect.

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.