Skip to content

Commit

Permalink
🦊 🐛 Fix setting sample images before carousel script has loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
leolabs committed Mar 16, 2018
1 parent 4241d39 commit 7c4b718
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,20 @@ <h2>Filters</h2>
kenBurnsCarousel.src = 'ken-burns-carousel.min.js';
document.head.appendChild(kenBurnsCarousel);

// Feed demo with sample images
const sampleImages = [
'https://source.unsplash.com/Qh9Swf_8DyA',
'https://source.unsplash.com/O453M2Liufs',
'https://source.unsplash.com/1OtUkD_8svc',
'https://source.unsplash.com/gIgciC_WKnY',
'https://source.unsplash.com/LCguCXU3Ffk',
];

const demos = document.getElementsByTagName('ken-burns-carousel');
for(let demo of demos) {
demo.images = sampleImages;
kenBurnsCarousel.onload = () => {
// Feed demo with sample images
const sampleImages = [
'https://source.unsplash.com/Qh9Swf_8DyA',
'https://source.unsplash.com/O453M2Liufs',
'https://source.unsplash.com/1OtUkD_8svc',
'https://source.unsplash.com/gIgciC_WKnY',
'https://source.unsplash.com/LCguCXU3Ffk',
];

const demos = document.getElementsByTagName('ken-burns-carousel');
for(let demo of demos) {
demo.images = sampleImages;
}
}
});
</script>
Expand Down

0 comments on commit 7c4b718

Please sign in to comment.