fixed card image switcher on chrome

This commit is contained in:
Bachir Soussi Chiadmi 2021-08-05 11:13:22 +02:00
parent ee60bb2255
commit cc9ceede26
4 changed files with 9 additions and 7 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

@ -29,16 +29,18 @@ export default {
// switch images on mousemove
el.addEventListener('mousemove', function (event) {
const figs = this.querySelectorAll('figure.loaded')
console.log('mousemove', this, event, figs.length)
// console.log('mousemove', figs.length, this, event)
// let len = figs.length
// let w = this.clientWidth;
// let g = w / len;
// let delta = Math.floor(event.layerX / g)
let delta = Math.floor(event.layerX / (this.clientWidth / figs.length))
// console.log(event.offsetX, this.clientWidth, figs.length)
// console.log(event.offsetX / (this.clientWidth / figs.length))
let delta = Math.floor(event.offsetX / (this.clientWidth / figs.length))
delta = delta < 0 ? 0 : delta >= figs.length ? figs.length - 1 : delta
console.log('delta', delta)
// console.log('delta', delta)
figs.forEach((fig, index) => {
console.log(index)
// console.log(index)
if (index === delta) {
// fig.style.display = "block"
fig.classList.remove('hide')