Coder Social home page Coder Social logo

selvagsz / ember-carousel Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 15.0 1.89 MB

An ember addon for carousel component

Home Page: http://selvagsz.github.io/ember-carousel

License: MIT License

JavaScript 66.62% CSS 13.40% HTML 19.98%
carousel-component ember-cli ember-addon slider ember-carousel

ember-carousel's Introduction

ember-carousel

An ember addon for Carousel component

DEMO

Usage

From within your Ember CLI application, run the following:

ember install ember-carousel

Add invoke the component as follows

{{#carousel-container transitionInterval=400 as |ui controls|}}
  <div class="carousel-body">
    {{#ui.item}}
      Emberjs
    {{/ui.item}}
    {{#ui.item}}
      Reactjs
    {{/ui.item}}
    {{#ui.item}}
      Angularjs
    {{/ui.item}}
  </div>

  <button onclick={{controls.previous}}>
    Slide Left
  </button>
  <button onclick={{controls.next}}>
    Slide Right
  </button>
{{/carousel-container}}

API

{{carousel-container}}

This is the primary component to start displaying carousel items.

Attributes

  • transitionInterval - Defaults to 500.
  • onSlide - Optional, an action that receives one parameter, an object like { index: 3, previousIndex: 2, direction: 'right' }.
    Triggered before the transition is completed.

Yielded Params

This component yields two hashes, e.g. {{#carousel-container as |ui act|}}. These parameters ui and act can be called anything, but they contain the following items:

  • ui - is a hash with the following component items:
    • item - A component that should contain your slide contents, used like so {{ui.item}}you content{{/ui.item}}.
  • controls - is a hash with the following action items:
    • previous - A closure action that changes to the previous slide.
    • next - A closure action that changes to the next slide.

Development

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

ember-carousel's People

Contributors

ember-tomster avatar florisvanvoorst avatar kategengler avatar knownasilya avatar maprules1000 avatar miguelcobain avatar selvagsz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

ember-carousel's Issues

load additional ui.item dynamically

Hey there,

Does this addon support loading additional objects to the carousel dynamically? For my use case, I would like to add an item to the carousel as they are appended to a list. Currently I am seeing the below error if the carousel is rendered and an item is appended to the list for it to display:

"Assertion Failed: Cannot update watchers for isActive on <app@component:carousel-item::ember3062> after it has been destroyed."

Cheers

Feature Request: auto-play

carousel-container transition-interval=100 not working. I set the transition-interval to 100, so expecting to change the image in 100 milli sec. But images are not changing till manually click on right and left button.

Bug: multiple slides showing at once

So if you click right and then left (or vice-versa) really quick, the old slide stays on the screen and now you have two slides. This can be reproduces in the demo app.

carousel

The installation process is corrupted in some way.

I tried to install with ember install ember-carousel, the installation works fine, but in the
/node_modules/ember-carousel/addon/templates/components/carousel-container.hbs. There is only single line of{{yeild}} in the file. Obviously the component does not work.

screen shot 2017-11-01 at 19 56 04

Example on `npmjs.org` is out of date

I'm not sure if this is an issue with npmjs.org or some config problem with this project, but figured you'd want to know that the example on npmjs.org is from an older version of the README. It shows

{{#carousel-container transitionInterval=400}}
  {{#carousel-body}}
    {{#carousel-item}}
      Emberjs
    {{/carousel-item}}
    {{#carousel-item}}
      Reactjs
    {{/carousel-item}}
    {{#carousel-item}}
      Angularjs
    {{/carousel-item}}
  {{/carousel-body}}
 
  {{#carousel-arrow direction="left" tagName="button"}}
    Slide Left
  {{/carousel-arrow}}
  {{#carousel-arrow direction="right" tagName="button"}}
    Slide Right
  {{/carousel-arrow}}
{{/carousel-container}}

instead of the contextual syntax.

Bug: Not Compatible with 2.10 (Glimmer 2) & Emberfire

Trying to use this with 2.10 (Which includes Glimmer 2) and I get this error message:

Assertion Failed: You modified isActive twice on <...carousel-item> in a single render. This was unreliable and slow in Ember 1.x and is no longer supported. See emberjs/ember.js#13948 for more details.

It looks like this relied on a deprecated pattern of setting values while the component was still rendering and now, with Glimmer 2 in 2.10, that deprecated pattern has been wholly prevented which prevents ember-carousel from working.

Bug: A helper named 'carousel-container' could not be found

If you put anything other than an <img> into the {{carousel-item}} block, you get the A helper named 'carousel-container' could not be found error.

{{#carousel-item}}
  <div></div>
{{/carousel-item}}

More complicated example:

{{#if data.length}}
  {{#carousel-container transition-interval=400}}
    {{#carousel-body}}
      {{#each data as |datum|}}
        {{#carousel-item}}
          {{#each datum as |item idx|}}
            {{#with (get-field group.fields idx) as |field|}}
              {{#if (eq field.displayType 'image')}}
                <img src="{{item}}" class="carousel-image img-responsive" alt="{{field.property}}"/>
              {{else}}
                {{#if (eq field.displayType 'url')}}
                  <a href="{{item}}" target="_blank" title="{{field.property}}">Link</a>
                {{else}}
                  {{item}}
                {{/if}}
              {{/if}}
            {{/with}}
          {{/each}}
        {{/carousel-item}}
      {{/each}}
    {{/carousel-body}}

    <div class="row">
      <div class="col-xs-6">
        {{#carousel-arrow direction="left" tagName="button" class="btn btn-link btn-block"}}
          Previous
        {{/carousel-arrow}}
      </div>
      <div class="col-xs-6">
        {{#carousel-arrow direction="right" tagName="button" class="btn btn-link btn-block"}}
          Next
        {{/carousel-arrow}}
      </div>
    </div>
  {{/carousel-container}}
{{/if}}

In this example, the <a> throws the error.

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.