Comments (8)
This library fixed the issue for me: https://github.com/David-Desmaisons/Vue.ImagesLoaded
from vue-flickity.
@pjhartin
import the package:
import imagesLoaded from 'vue-images-loaded'
add the directive:
directives: { imagesLoaded }
then on your flickity component:
<flickity ref="flickity" :options="flickityOptions" v-images-loaded="imgsLoaded">
<img :src="image.image" alt="" v-for="(image, index) in images" :key="index">
</flickity>
v-images-loaded
triggers the method imgsLoaded
which can turn the opacity from 0 to 1 for each image ... at once or all together depending on how you configure the directive.
from vue-flickity.
I'm not sure this is the right place to ask this. But would you mind sharing some code and I'll have a look to see if I can be of any help? :)
from vue-flickity.
Perhaps, but a common use case for Flickity is with images and I can't find an example of that here -- so it may be appropriate.
The issue is described in this example http://flickity.metafizzy.co/options.html#imagesloaded and here: http://codepen.io/desandro/pen/MYQWEe
I have an array of images I want to share with the component but it doesn't render correctly sometimes because Flickity fires before the images are loaded. How have you been able render images successfully with this component? Or maybe I need to pull in imagesLoaded too
from vue-flickity.
@rugor I had the same issue, but luckily in my case all the images were the same size, so I gave fixed dimensions to their containers with CSS - That way, Flickity doesn't have to wait for the images to be fully loaded for correctly rendering the items
from vue-flickity.
@davekiss - When you say it fixed it, how did it fix it, what did you hook into when the image was processed?
from vue-flickity.
Thanks mate for the clarification. I actually was wondering about the issue where images are dynamically added but it causes a problem where Flickity wouldn't resize properly: https://flickity.metafizzy.co/options.html#imagesloaded
I got it in the end by adding a reference to Flickity and calling the reloadCells
function.
imgsLoaded(instance, image) {
// Reload flickity cells due to height change post
let flickityInstance = this.$refs.flickity;
flickityInstance.reloadCells();
}
from vue-flickity.
from vue-flickity.
Related Issues (20)
- Any plans to support the flickity-fullscreen option? HOT 6
- Carousel not displaying properly HOT 4
- How to use Flickity Events? HOT 12
- Router links triggers during slides draggin HOT 5
- only show one pre page
- How can i instance multiple vue flickity in the same page? HOT 1
- cannot access flickity via this.$refs HOT 1
- A few methods are missing
- Open a fullscreen container with the image and comments HOT 1
- License: GPLv3 or MIT?
- Sometimes works fine, sometimes does not work properly HOT 1
- Using flickity lazyload: no effect HOT 1
- Provide API for parent component to control the destroying of Flickity HOT 1
- Cells get rendered in reverse HOT 2
- Best way to reinit HOT 1
- Request: support for imagesLoaded option HOT 2
- Fade option not working HOT 4
- Flickity + Typescript Errors: Bad Element for Flickity: .carousel HOT 1
- Images flicker when going to previous route HOT 1
- Carousel Stuck on Last Slide HOT 2
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 vue-flickity.