Git Product home page Git Product logo

Comments (8)

lifeart avatar lifeart commented on July 4, 2024

+1

from ember-cli-photoswipe.

dzena avatar dzena commented on July 4, 2024

I have the same problem. I'm using ember 1.12.0 and ember-cli 1.13.8.
Solve the problem in the following way though:

{{#photo-swipe}}
 {{#each model.product.pictures as |img|}}
     <a class="photo-item" href={{img.readUrl}} data-width="100" data-height="100">
        <img src={{img.readUrl}} width="100" height="100" alt={{img.fileName}}>
     </a>
 {{/each}}
{{/photo-swipe}}

I just realised that this is def. not a good solution. Mainly because data- attributes will always have a static value, and that fact will affect your pictures (height and width) when you open the gallery.

from ember-cli-photoswipe.

davidgoli avatar davidgoli commented on July 4, 2024

Please don't do as @dzena's example shows - this is deprecated, breaks the bindings, and prevents updates to your model from being reflected in the slideshow. Instead, make sure your items are structured as follows:

items = [
  {
    src: 'http://your/photo.jpg',
    w: 320,
    h: 480,
    title: 'fancy pic',
    msrc: 'bigger size url'
  }
];

Then invoke the component like so:

{{#photo-swipe items=items as |item|}}
  <img src={{item.src}} alt={{item.title}} />
{{/photo-swipe}}

For most of us, this will mean mapping your model properties into the PhotoSwipe item structure.

from ember-cli-photoswipe.

davidgoli avatar davidgoli commented on July 4, 2024

Oh and here's another thing - the latest published version 1.1.0 is not using the same code as you see on the master branch; it's a few commits behind and doesn't work with the README you see here. Hopefully the maintainers of this addon will wake up from their deep deep sleep and publish a new version with what they have here in master. Until then, you can pin in package.json:

"ember-cli-photoswipe": "poetic/ember-cli-photoswipe#master"

from ember-cli-photoswipe.

dzena avatar dzena commented on July 4, 2024

@davidgoli
I still have the same problem. Nothing is being rendered.
ember-cli: 1.13.8
ember: 1.12.0

 items: Ember.computed("model.product.pictures.[]", function () {
    var pictures = this.get("model.product.pictures");

    var items = [];

    pictures.forEach(function (picture) {
      var item = {
        src: picture.get("readUrl"),
        w: 320,
        h: 480,
        title: picture.get("fileName"),
        msrc: "bigger"
      };

      items.push(item);
    });

    return items;
  }),
{{#photo-swipe items=items as |item|}}
      <img class="thumb" src={{item.src}} alt={{item.title}} />
{{/photo-swipe}}

from ember-cli-photoswipe.

davidgoli avatar davidgoli commented on July 4, 2024

@dzena what version of ember-cli-photoswipe are you running?

from ember-cli-photoswipe.

dzena avatar dzena commented on July 4, 2024
"ember-cli-photoswipe": "poetic/ember-cli-photoswipe#master"

from ember-cli-photoswipe.

davidgoli avatar davidgoli commented on July 4, 2024

I just published 1.2.0 to npm so you should once again be able to point to that version now for this functionality.

from ember-cli-photoswipe.

Related Issues (20)

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.