Always reset carousel image width to auto before re-adjusting the size

This commit is contained in:
Fabio Manganiello 2019-07-08 00:16:43 +02:00
parent b2c31fcec6
commit c19251c6a1

View file

@ -25,10 +25,9 @@ Vue.component('image-carousel', {
onNewImage: function() {
this.$refs.background.style['background-image'] = 'url(' + this.currentImage + ')';
if (this.$refs.img.width > this.$refs.img.height) {
this.$refs.img.style.width = 'auto';
if (this.$refs.img.width > this.$refs.img.height) {
if ((this.$refs.img.width / this.$refs.img.height) >= 1.25) {
this.$refs.img.style.width = '100%';
}