Comments (14)
I suppose that if this feature were to be added now it might make sense to use the new in-element
feature?
from ember-cli-photoswipe.
The polyfill wasn't compatible with the latest version of Ember - this has now been fixed.
With a little help from the author of the in-element polyfill I managed to get in-element working - removing the need for ember-wormhole:
https://github.com/MrChriZ/ember-cli-photoswipe/tree/useInElement
I have a bug I'm still thinking about which is that the consuming application has to manually add the polyfill in:
ember install ember-in-element-polyfill
I have the polyfill as a dependency rather than a dev dependency in ember-cli-photoswipe... and as such the polyfill installs with ember-cli-photoswipe... but then doesn't seem to get picked up by the browser. Manually installing the polyfill on the consuming application fixes the problem 😕
Unfortunately... in-element doesn't solve the Liquid-fire problem. 😬
from ember-cli-photoswipe.
I'll definitely look into it.
from ember-cli-photoswipe.
yeap, ti might be very useful. When ember-liquidfire is in use, it gives full page height, and photoswipe renders in the middle of nowhere :)
from ember-cli-photoswipe.
^having the same issue
from ember-cli-photoswipe.
Is this project no longer maintained?
from ember-cli-photoswipe.
Just ran into this problem too...
from ember-cli-photoswipe.
I would suggest looking into https://github.com/glidejs/glide - as it worked well for me as a replacement for this library. And you don't need much integration with ember.
from ember-cli-photoswipe.
I don't think glide is a good replacement at all, they do different things.
I think with ember-auto-import it should be fairly simple for people to roll their own photoswipe backed components though.
from ember-cli-photoswipe.
@evoactivity indeed, apologies. Confused this addon with owl carousel :) I didn't have particular love to photoswipe and owl carousel... so ditched photoswipe and used glide instead of owl.
from ember-cli-photoswipe.
So it seems the in-element feature isn't available yet in Ember. If you try you get an error message saying you can't use in-element. I read things about using a private API using -in-element but couldn't seem to get that to work at all - the element never moved.
I then had a play with ember-wormhole. I moved the pswp element into it's own component such that it looked like this:
ember-cli-photoswipe/app/templates/components/photo-swipe.hbs
{{#if options.destination}}
<div>
{{#ember-wormhole to=options.destination}}
{{pswp-element}}
{{/ember-wormhole}}
</div>
{{/if}}
Unfortunately this however broke the ember photoswipe component which uses jquery to find the pswp component.
/ember-cli-photoswipe/addon/components/photo-swipe.js
this.set("pswpEl", this.$(".pswp")[0]);
Since it's been wormholed it can no longer be found.
I found this issue which describes this issue:
yapplabs/ember-wormhole#31
There's a number of potential solutions there including using the destination with a global jquery request which seemed to work.
ember-cli-photoswipe/addon/components/photo-swipe.js
if (this.get("options.destination")) {
let destinationElement = "#" + this.get("options.destination") + " .pswp";
this.set("pswpEl", Ember.$(destinationElement)[0]);
} else {
this.set("pswpEl", this.$(".pswp")[0]);
}
Then it's just a case of putting the destination in to the options. So I created a third example on the application.hbs page
tests/dummy/app/templates/application.hbs
<!-- example 3 - with destination -->
<h3>Example with destination</h3>
{{#photo-swipe options=psThreeOpts items=items as |image|}}
<img class="thumb" src={{image.src}} alt={{image.title}}>
{{/photo-swipe}}
/tests/dummy/app/controllers/application.js
psThreeOpts: {
destination:'destination'
}
I've pushed a copy of this to here:
https://github.com/MrChriZ/ember-cli-photoswipe/tree/addEmberWormhole
I've not added a pull request as yet though as I thought I'd just get peoples thoughts first.
from ember-cli-photoswipe.
@MrChriZ nice work!
I haven't tried it yet, but I believe you need the in-element polyfill: https://github.com/kaliber5/ember-in-element-polyfill#readme
from ember-cli-photoswipe.
Thanks - I did have a go with the polyfill as well but couldn't seem to get anywhere with it.
Probably was missing something obvious.
from ember-cli-photoswipe.
RuzlanZavacy mentioned liquid-fire above.
I'm also using this and thought I'd also just mention that I needed to kill some of liquid-fires built in CSS
Like so:
.liquid-container {
position: initial;
-webkit-transform: initial;
-moz-transform: initial;
transform: initial;
}
These were causing the photoswipe animation to start in the wrong place.
In my case this doesn't seemed to have caused any issues - however I've not done extensive browser testing as yet so YMMV.
Additional note. Ember wormhole and Liquid fire don't seem to work well together 👎
The wormhole stops working after a transition.
from ember-cli-photoswipe.
Related Issues (20)
- Update readme / package be compatible with `install:addon` HOT 2
- Update version of photoswipe HOT 1
- Code coverage HOT 2
- Add ability to pass options into the component HOT 1
- Cannot convert a Symbol value to a string HOT 9
- Update addon's ember-cli release HOT 1
- generator needs to run every time the bower_components dir is cleared.
- element index is not being passed to photoswipe click method HOT 3
- Programmatically update when items change
- Uncaught TypeError: Cannot assign to read only property 'initialLayout' of false HOT 9
- Doesnt work with embercli with ember 2.0 HOT 8
- Addon does not work as advertised HOT 7
- How to configure Ui HOT 1
- error: "event listener's handler isn't a function or empty" HOT 1
- Using ember-cli-photoswipe without an 'items' attribute is deprecated. HOT 1
- Empty src causes component crash
- Possible to make specific sections clickable?
- msrc attribute is not working
- User PhotoSwipe NPM package instead of Bower
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-photoswipe.