Giter Club home page Giter Club logo

ember-cli-slick's Introduction

ember-cli-slick

ember-cli-slick is a component that wraps the Slick Slider plugin functionality.

Compatibility

  • Ember.js v2.18 or above
  • Ember CLI v2.13 or above

Installation

ember install ember-cli-slick

slick-slider

{{#slick-slider autoplay=true arrows=false}}
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
{{/slick-slider}}

The Slick events will be send from the component to your controller or route

(the swipe event will send a swiped in order to prevent naming issues)

{{#slick-slider	afterChange='afterChange'}}
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
{{/slick-slider}}

Init Event

A slickInit event may be bound from your template. This event is triggered after Ember's internal didInsertElement with a DOM reference to the newly created widget allowing direct manipulation of the DOM elements after creation.

{{#slick-slider	slickInit="someInitAction"}}
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
{{/slick-slider}}

The responsive configuration needs to be passed by a controller property

{{#slick-slider	responsive=breakpoints}}
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
  <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div>
{{/slick-slider}}
import Ember from 'ember';

export default Ember.Controller.extend({
	breakpoints: [
		{
		  'breakpoint': 1024,
		  'settings': {
		    'slidesToShow': 3,
		    'slidesToScroll': 3,
		    'infinite': true
		  }
		},
		{
		  'breakpoint': 600,
		  'settings': {
		    'slidesToShow': 2,
		    'slidesToScroll': 2
		  }
		},
		{
		  'breakpoint': 480,
		  'settings': {
		    'slidesToShow': 1,
		    'slidesToScroll': 1
		  }
		}
	]
});

Customization

This widget supports the full range of slick-slider configuration options. The full list with descriptions can be found at the slick-slider homepage: http://kenwheeler.github.io/slick/

  • accessibility
  • adaptiveHeight
  • autoplay
  • autoplaySpeed
  • arrows
  • asNavFor
  • appendArrows
  • appendDots
  • prevArrow
  • nextArrow
  • centerMode
  • centerPadding
  • cssEase
  • customPaging
  • dots
  • draggable
  • fade
  • focusOnSelect
  • easing
  • edgeFriction
  • infinite
  • initialSlide
  • lazyLoad
  • mobileFirst
  • pauseOnHover
  • pauseOnDotsHover
  • respondTo
  • responsive
  • rows
  • slide
  • slidesPerRow
  • slidesToShow
  • slidesToScroll
  • speed
  • swipe
  • swipeToSlide
  • touchMove
  • touchThreshold
  • useCss
  • variableWidth
  • vertical
  • verticalSwiping
  • rtl

Repo

  • git clone this repository
  • cd ember-cli-slick
  • npm install

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

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

License

=======

This project is licensed under the MIT License.

ember-cli-slick's People

Contributors

4xposed avatar ember-tomster avatar gfrymerblink avatar gorner avatar laantorchaweb avatar mabab avatar max-konin avatar mistahenry avatar santhoshraju91 avatar superjova avatar sweco-secfha avatar systembugtj avatar tobiaslounsbury avatar ynnoj 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

Watchers

 avatar

ember-cli-slick's Issues

Ember focus event don't work on input inside the slider

Hi,
I'm trying to add focus-in and focus-out events on an input inside the slider but they don't seem to work. I've created a fresh project just for test but it's still not working. The events work only from the input outside the slider tags.

{{#slick-slider autoplay=false arrows=true focusOnSelect=true}} <div class="box"> {{input focus-in=(action "in") focus-out=(action "out")}} <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div> <div class="box"> <img src="https://static2.businessinsider.com/image/4f3433986bb3f7b67a00003c/a-parasite-found-in-cats-could-be-manipulating-our-brains.jpg"> </div> {{/slick-slider}} {{input focus-in=(action "in") focus-out=(action "out")}}

and the actions

actions:{ out() { console.log('out') }, in() { console.log('in') } }

I don't know if it is a bug or I'm not doing something right.

Publish to npm?

It looks like the latest on master pulls slick from npm. Can you publish a new version to npm?

Ember 3.5

Hi,
I try to update an old application based on Ember 2.13 to Ember 3.5 and now my last problem is to use your plugin in the new ember 3.5 environment.

This error occurred:
loader.js:247 Uncaught Error: Could not find module emberimported fromember-cli-slick/components/slick-slider at missingModule (loader.js:247) at findModule (loader.js:258) at Module.findDeps (loader.js:168) at findModule (loader.js:262) at Module.findDeps (loader.js:168) at findModule (loader.js:262) at requireModule (loader.js:24) at Class._extractDefaultExport (index.js:422) at Class.resolveOther (index.js:101) at Class.resolve (index.js:163)

Do you have a tipp for me?

Addon doesn't work with ember version 2.12 onwards.

Hello @laantorchaweb ,

We have been using this addon in our project and during the upgrade, I found out that the addon was not compatible with the version 2.12.3, since ember have now moved to ember-source and ember-cli-shims for managing bower dependencies.

Kindly review the PR and let me know if there is any changes I need to make so you may merge it. Always happy to help.

Warm Regards

Convert from bower to npm

Is there plans to move from bower to npm? It seems like all your bower dependencies are now in the npm repository

Deprecated error - ember-cli-htmlbars upgrade to 1.0.10 is needed

Installed packages for tooling via npm.
DEPRECATION: Overriding init without calling this._super is deprecated. Please call this._super.init && this._super.ini t.apply(this, arguments); addon: ember-cli-htmlbars
at Function.Addon.lookup (C:\Stufessor\slick\node_modules\ember-cli\lib\models\addon.js:896:27)
installing ember-cli-slick

Getting error (The package `ember-cli-slick` is not a properly formatted package}

The package ember-cli-slick is not a properly formatted package, we have used a fallback lookup to resolve it at C:\Users\Carlos\Desktop\web-apps\del_sur\node_modules\ember-cli-slick. This is generally caused by an addon not having a main entry point (or index.js).
The ember-cli-slick addon could not be found at C:\Users\Carlos\Desktop\web-apps\del_sur\node_modules\ember-cli-slick.

ember-cli tests (ember test) hangs when using this addon

I noticed that the tests hang and don't run after build whenever I use this addon.

It still happen son an new empty project:

ember new blabla
cd blabla
ember install ember-cli-slick
ember test

and after Build project successfully... hangs there indefinitely.

Refresh slide when contents dynamically changed

Hi,

I'm using this addon to display a card list. Right now I have a polling service to pull the new card list from api every other hour.
I can see from slick repo, there is a similar issue: kenwheeler/slick#1191, basically it needs to destroy the slick and re-initialize again.

Could we support this feature?

init scripts don't run on route transitions

I'm trying to use dynamic slides dependent on the route. Ex:

{{#slick-slider autoplay=false arrows=true}}
  {{#each model.slides as |slide|}}
  <div class="box"> <img src="{{slide}}"> </div>
  {{/each}}
{{/slick-slider}}            

I have routes like this:
/page/1, /page/2, /page/3

The model.slides depends on the pageId

It works when I'm on a current page and refresh the page. But if I transition from /page/1 to /page/2, the component doesn't rebuild itself with the new content. Similarly, if I transition from /index (no slides) to /page/1, the component seems to load fine, but the container height is only 1px.

Not compatible with [email protected] / [email protected]

Using [email protected] with this package, I get the following error at bootup:

Cannot find module '/Users/denchen/git/my-app/bower_components/ember/ember-template-compiler.js'
Error: Cannot find module '/Users/denchen/git/my-app/bower_components/ember/ember-template-compiler.js'
  at Function.Module._resolveFilename (module.js:325:15)
  at Function.Module._load (module.js:276:25)
  at Module.require (module.js:353:17)
  at require (internal/module.js:12:17)
  at Class.module.exports.htmlbarsOptions (/Users/denchen/git/my-app/node_modules/ember-cli-slick/node_modules/ember-cli-htmlbars/ember-addon-main.js:78:25)
  at Object.registry.add.toTree (/Users/denchen/git/my-app/node_modules/ember-cli-slick/node_modules/ember-cli-htmlbars/ember-addon-main.js:31:36)
  at /Users/denchen/git/my-app/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:180:26
  at Array.forEach (native)
  at processPlugins (/Users/denchen/my-app/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:178:11)
  at module.exports.preprocessTemplates (/Users/denchen/git/my-app/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:161:10)

I believe this is due to this change in [email protected]:

As part of this release we have made the default behavior inclusion of Ember from npm via the ember-source npm package.

Which means that Ember is no longer a Bower dependency / package, and hence bower_components/ember/ember-template-compiler would not be available.

Properly destroy component

Hi, I was running into an issue where switching between routes that were using this slick addon, my app would throw an error:

Assertion Failed: Attempted to call .sendAction() with the action 'setPosition' on the destroyed object '<labs-waterfront-access@component:slick-slider::ember403>

My solution was to extend ember-cli-slick to call the slick('unslick') method, which turns off all of the listeners that were turned on when the component first initializes. It seems like this should be added to the component. If you agree, I am happy to do a PR.

export default SlickSliderComponent.extend({
  willDestroyElement() {
    this.$().slick("unslick");
  },
});

custom pagination

Hi,
How can I customize the dots, to became something like ids, or tabs name?
Or how can I use the slick methods like: slickGoTo, slickCurrentSlide, slickNext, slickPrev to realize that?
I appreciate any hint.

setting dots=true breaks the slider

when setting dots to true the slider doesn't load properly.

  {{#slick-slider autoplay=false arrows=true dots=true infinite=false}}
    <div class="box">
      <h1>Page 1</h1>
    </div>
    <div class="box">
      <h1>Page 2</h1>
    </div>
    <div class="box">
      <h1>Page 3</h1>
    </div>
    <div class="box">
      <h1>Page 4</h1>
    </div>
  {{/slick-slider}}

The console gives throws this error:

Uncaught TypeError: Cannot read property 'call' of null

Ember CLI Babel 6.6

Is there plans on upgrading your plugin to support ember-cli-babel 6.6? I am getting deprecation warnings

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.