fixed card image switcher on chrome
This commit is contained in:
parent
ee60bb2255
commit
cc9ceede26
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -29,16 +29,18 @@ export default {
|
||||||
// switch images on mousemove
|
// switch images on mousemove
|
||||||
el.addEventListener('mousemove', function (event) {
|
el.addEventListener('mousemove', function (event) {
|
||||||
const figs = this.querySelectorAll('figure.loaded')
|
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 len = figs.length
|
||||||
// let w = this.clientWidth;
|
// let w = this.clientWidth;
|
||||||
// let g = w / len;
|
// let g = w / len;
|
||||||
// let delta = Math.floor(event.layerX / g)
|
// 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
|
delta = delta < 0 ? 0 : delta >= figs.length ? figs.length - 1 : delta
|
||||||
console.log('delta', delta)
|
// console.log('delta', delta)
|
||||||
figs.forEach((fig, index) => {
|
figs.forEach((fig, index) => {
|
||||||
console.log(index)
|
// console.log(index)
|
||||||
if (index === delta) {
|
if (index === delta) {
|
||||||
// fig.style.display = "block"
|
// fig.style.display = "block"
|
||||||
fig.classList.remove('hide')
|
fig.classList.remove('hide')
|
||||||
|
|
Loading…
Reference in New Issue