metafizzy / flickity-docs

:memo: documentation for Flickity
28 stars 8 forks source link

Initial focus demo correction #7

Closed csillery closed 8 years ago

csillery commented 9 years ago

Followed your demo on setting the initial focus but my gallery of images did not draw fully. I think what's happening is that if you're using images with the imagesLoaded option set and call flickity().focus() on $(document).ready() then the gallery will not draw properly. I finally put the .focus() call in $(window).load() and it worked fine. Or maybe I'm doing something wrong.

desandro commented 9 years ago

I'm sorry to see you're having trouble with Flickity. Could you provide a reduced test case? See Submitting Issues in the contributing guidelines.

csillery commented 9 years ago

No need to be sorry, I'm not really having trouble. I posted the comment as more of an FYI. If you have a gallery of images using the imagesLoaded option as opposed to the CSS in your demo then calling .focus() as in your example will not load the images $( function() { // init flickity and focus $('.gallery').flickity().focus(); }); But if you call it this then it works $(window).load(function() { $('.gallery').flickity().focus(); });