3d Image footage
JavaScript Part Code
Copy Code code as follows:
<span style= "White-space:pre" > </span>var step = 0;
var-0;
var lth = document.queryselectorall (' #tobj img '). length;
Window.addeventlistener (' Touchstart ', function (e) {
E.preventdefault ();
i = E.touches[0].pagex;
})
Window.addeventlistener (' Touchmove ', function (e) {
E.preventdefault ();
var x = E.pagex | | E.touches[0].pagex;
document.getElementById (' outs '). InnerHTML = step;
if (Math.Abs (X-first) >10) {
Document.queryselectorall (' #tobj img ') [step].style.display = ' None '
if (X<first) {
step++;
if (step>=lth-1) {
Step =0
}
}else{
step--
if (step<=0) {
Step = lth-1;
}
}
i = x;
Document.queryselectorall (' #tobj img ') [step].style.display = ' block '
}
})
Window.addeventlistener (' Touchend ', function (e) {
E.preventdefault ();
Step = step;
})
Core streamlining
Copy Code code as follows:
if (Math.Abs (X-first) >10) {
Document.queryselectorall (' #tobj img ') [step].style.display = ' None '
if (X<first) {
step++;
if (step>=lth-1) {
Step =0
}
}else{
step--
if (step<=0) {
Step = lth-1;
}
}
i = x;
Document.queryselectorall (' #tobj img ') [step].style.display = ' block '
}