Git Product home page Git Product logo

ember-cli-photoswipe's Introduction

Ember-cli-photoswipe Build Status

Ember-cli Addon adaptation of the popular photo gallery library PhotoSwipe.

Usage

{{#photo-swipe items=model as |img|}}
  <img class="thumb" src={{img.src}} alt={{img.title}}>
{{/photo-swipe}}

By wrapping your gallery in the component, the addon will take care of instantiating PhotoSwipe for you and for calculating the thumbnail bounds so you get the nice zoom in/out animations right out of the box. Easy, right?

See tests/dummy/app/templates/application.hbs as an example of this.

The items property is required and an array of objects should be passed to it. PhotoSwipe expects these items to have the following structure:

[
  {
    src: 'http://placekitten.com/g/600/400',
    w: 600,
    h: 400,
    title: 'whooa',
    msrc: '(optional) larger image'
  }
]

If you want to instantiate a PhotoSwipe gallery from an action instead of a thumbnail, you can also do the following:

{{photo-swipe gallery=myGallery options=psOpts items=items}}

And then you can initialize it through an action in your controller like this:

actions: {
  initGallery: function() {
    this.get('myGallery').init();
  }
}

Any property bound to gallery will become the actual gallery object. This is used to instantiate PhotoSwipe and to interact with the live instance.

Any PhotoSwipe options can be passed to the options property of the component. For now the history module is disabled since it breaks ember routing.

More functionality is on the way, this is a work in progress. You can find PhotoSwipe documentation here.

More Options

You can pass the following extra options to the options property in the PhotoSwipe component to hide PhotoSwipe buttons (default to false):

  1. hideClose
  2. hideShare
  3. hideToggleFullScreen
  4. hideZoomInOut

Contributing

If you have ideas or feature needs that could be implemented, just submit an issue or pull request.

Installation

Ember-cli >= 0.1.5

As easy as running ember install:addon ember-cli-photoswipe, which will also run the generator.

Ember-cli < 0.1.5

For versions under 0.1.5 you need to run npm install ember-cli-photoswipe --save-dev.

Running

To run the dummy app:

  • git clone https://github.com/DanyHunter/ember-cli-photoswipe.git
  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

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

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.