-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Height not resizing properly with imagesLoaded and Firefox/IE #205
Comments
Thanks for reporting this issue and for providing a reduced test case 😀 I'm not sure if I see an issue. You may be noticing how slider is not resized until the window has completed resizing. This is a performance feature. Instead of resizing every millisecond and costing your users multiple unnecessary reflows, Flickity resizes the slider after the window has been resized. There is a slight delay, 150 ms, but it keeps your page feeling snappy. |
The issue here is that it STAYS un-resized. so the first time a user visits the page there is a massive amount of negative space under the slider. I think your approach is great for performance and works well in the other browsers it appears. but it's not working here. Perhaps there is an event i could hook into for the creation of the slider the first time so i can trigger a resize manually? |
I've made a screen cast to explain the issue and why I believe it to be an issue. |
Ah, Thanks for that. So the issue is: sometimes, in Firefox, the slider is not resized to fit the images. I've been able to reproduce this issue, but it doesn't happen every time. Taking a look at it, the problem lies somewhere with imagesLoaded. The bug occurs when it is not triggered on every cell. This may be related to desandro/imagesloaded#191. You may want to use lazyLoad as an alternative solution to imagesLoaded for now. I hope to resolve the issue with imagesLoaded, which will resolve this issue. |
Thanks David. I'll give lazyload a try. I'll also subscribe to bug 191 on images loaded. |
Not sure if my issue is related but after I read the whole thread I believe it is. It just looked like Flickity was firing before images and cells where being loaded. I had a go with $(window).load rather than document.ready and all is fine now. I know its been a few months but hopefully this might help somebody else. |
Using |
yeh you are correct of course. do you advise any other solution, because the imageloaded and lazyload didnt work for me at all? Thank and keep up the excellent work ;) |
Adding this to the end of my script solved it for me: jQuery(window).load( function() {
window.dispatchEvent(new Event('resize'));
}); |
I would recommend changing the title as this seems not be browser specific. On my case, it works fine on Firefox but not on Chrome. |
I am also running into this problem. I tried different Flickity configurations. Without Is there a recommended workaround with vanilla JS? |
I also experience this issue with the latest Chrome version. Neither with imagesLoaded: true, I now use @slimndap snippet which works for me and fires the Resize event. If the images are initially there the slider gets initialized correctly, if not the slider gets its proper size after the Resize event gets triggered. |
@slimndap not a bad hack. Rather than triggering a window // jQuery
$( window ).on( 'load', function() {
$carousel.flickity('resize');
}); // vanilla JS
window.addEventListener( 'load', function() {
flkty.resize();
}); |
I'm having this same issue in the latest Firefox, Chrome and Safari. It works better on page load, but I have a fullscreen gallery (thumbnails below) that launches and needs to be resized. If I simply call You can also see the overlapping images issue seen with |
Hm I've the same problem. Image Overlapping and huge margin bottom.
does not help. Hm |
I have the same problem. Chrome 57 Mac. The onload hack works for me. However, I needed a solution for several Flickity instances that were initiated in HTML. I solved it this way: window.addEventListener('load', function() {
var elements = document.getElementsByClassName('js-flickity');
for (var i = 0; i < elements.length; i++) {
var flkty = Flickity.data(elements[i]);
flkty.resize();
}
}); |
Thanks @solemone
|
This issue happens because when using data attributes Flickity is initialized on 'DOMContentLoaded'. At the time some images still might be not loaded. |
@vaidotas-adf Thanks for reporting this issue. Could you open a new issue and provide a reduced test case? See Submitting Issues in the contributing guidelines. |
Is this still a problem, even when using lazyload? I've got a basic test case here which is not resizing on load in Chrome 69 or Firefox 62 on Mac. |
I'm closing this issue as its grown old. Please open a new issue if you run into resizing issues with imagesLoaded or lazyLoad @daltonrooney Looks like your issue is caused by the placeholder data URI being in a square resolution. Flickity is reading that size instead. That looks to be a different edge case. |
I have a reduced test case here http://codepen.io/infn8/pen/pJGJjJ It is forked from this pen.
Steps to reproduce the issue:
I suggest making your browser window thin to begin with.
Running latest OSX and Latest Firefox
The text was updated successfully, but these errors were encountered: