Always reset carousel image width to auto before re-adjusting the size
This commit is contained in:
parent
b2c31fcec6
commit
c19251c6a1
1 changed files with 1 additions and 2 deletions
|
@ -25,10 +25,9 @@ Vue.component('image-carousel', {
|
||||||
|
|
||||||
onNewImage: function() {
|
onNewImage: function() {
|
||||||
this.$refs.background.style['background-image'] = 'url(' + this.currentImage + ')';
|
this.$refs.background.style['background-image'] = 'url(' + this.currentImage + ')';
|
||||||
|
this.$refs.img.style.width = 'auto';
|
||||||
|
|
||||||
if (this.$refs.img.width > this.$refs.img.height) {
|
if (this.$refs.img.width > this.$refs.img.height) {
|
||||||
this.$refs.img.style.width = 'auto';
|
|
||||||
|
|
||||||
if ((this.$refs.img.width / this.$refs.img.height) >= 1.25) {
|
if ((this.$refs.img.width / this.$refs.img.height) >= 1.25) {
|
||||||
this.$refs.img.style.width = '100%';
|
this.$refs.img.style.width = '100%';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue