This commit is contained in:
ManjaroOne666 2019-01-27 13:34:32 +00:00
parent b094a2f787
commit 9c4db9d0f9
4 changed files with 11 additions and 10 deletions

View File

@ -43,7 +43,9 @@ export default {
mounted () {
if (this.imageUrls.length > 1) {
setTimeout(() => {
this.preloadImage()
}, 100) // timeout so events get fired - don't know why that is yet TODO - investigate properly
}
},
@ -51,8 +53,7 @@ export default {
preloadImage () {
this.loadImage(this.imageUrls[this.currentlyLoadingIndex])
.then(img => {
this.$emit('imageLoaded', img.src)
console.log('imageloaded', img)
this.$emit('imageLoaded', img)
this.currentlyLoadingIndex++
if (this.currentlyLoadingIndex < this.imageUrls.length) {
this.preloadImage()
@ -60,12 +61,12 @@ export default {
})
.catch(err => {
// TODO handle error cases
console.log('imageloaded ERROR', img.src)
console.log('imageloaded ERROR', err)
})
},
handleImageLoaded (img) {
this.$emit('imageLoaded handler', img.src)
handleImageLoaded () {
this.$emit('imageLoaded', this.imageUrls[this.activeIndex])
}
}
}

View File

@ -55,6 +55,8 @@ export default {
.gallery-featured {
transition: opacity .3s; // TEMP
padding: 8px;
cursor: pointer;
}
.featured-image {

View File

@ -234,6 +234,8 @@ export default {
padding: 0 2px;
background-clip: content-box;
cursor: pointer;
}
@media (max-width: $bp__layout) {

View File

@ -88,10 +88,6 @@ export default {
methods: {
handleMouseOver(index) {
// TOOD this needs to only change if the transition has finished
// need to emit transitionend events on the background loaders
// and listen for them.
// if waiting for an transitionend event ignore the mouseover event
this.activeIndex = index
},
},