fixed home showroomcarroussel bug

This commit is contained in:
Bachir Soussi Chiadmi 2021-06-10 20:20:04 +02:00
parent 044346c016
commit 6722964893
4 changed files with 8 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -50,10 +50,11 @@ export default {
initShowroomCarroussel(){
console.log('startShowroomCarroussel')
this.showrooms = document.querySelectorAll('.field--name-computed-showrooms-reference > .field__item')
console.log('showrooms', this.showrooms)
if (!this.showrooms.lenght) {
console.log('showrooms', this.showrooms.length, this.showrooms)
if (!this.showrooms.length) {
return
}
// console.log('TEST')
for (let i = 0; i < this.showrooms.length; i++) {
if (i%2 === 0) {
this.showroomsOdd.push(this.showrooms[i])
@ -78,6 +79,7 @@ export default {
// this.switchShowroomCarroussel()
},
checkShowroomMode(mq){
console.log('checkShowroomMode', mq)
// default mode 1
let newmode = 1
if (mq.matches) {
@ -107,7 +109,7 @@ export default {
this.switchShowroomCarroussel()
},
switchShowroomCarroussel(){
// console.log('switchShowroomCarroussel i', $elmts, i)
console.log('switchShowroomCarroussel')
if (this.showroomMode === 1) {
this.showrooms[this.showroomI].classList.add('active')
this.showrooms[this.showroomI-1 < 0 ? this.showrooms.length -1 : this.showroomI-1].classList.remove('active')