Material de imagen de investigación 3D
Código de pieza de JavaScript
La copia del código es la siguiente:
<span style = "White-Space: pre"> </span> var step = 0;
var primero = 0;
var lth = document.QuerySelectorAll ('#tobj img'). Longitud;
Window.adDeventListener ('touchStart', function (e) {
E.PreventDefault ();
Primero = 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 - primero)> 10) {
document.queryselectorAll ('#tobj img') [step] .style.display = 'none'
if (x <primero) {
paso ++;
if (step> = lth-1) {
paso = 0
}
}demás{
paso--
if (step <= 0) {
paso = LTH-1;
}
}
primero = x;
document.QueryselectorAll ('#tobj img') [step] .style.display = 'bloque'
}
})
Window.adDeventListener ('touchend', function (e) {
E.PreventDefault ();
paso = paso;
})
Racionalización del núcleo
La copia del código es la siguiente:
if (math.abs (x - primero)> 10) {
document.queryselectorAll ('#tobj img') [step] .style.display = 'none'
if (x <primero) {
paso ++;
if (step> = lth-1) {
paso = 0
}
}demás{
paso--
if (step <= 0) {
paso = LTH-1;
}
}
primero = x;
document.QueryselectorAll ('#tobj img') [step] .style.display = 'bloque'
}