Javascript 3d detective products show of core streamlining
- 2020-03-30 02:26:16
- OfStack
3d detective photo footage
Javascript part of the code
Core streamline
Javascript part of the code
<span style="white-space:pre"> </span>var step = 0;
var first = 0;
var lth = document.querySelectorAll('#tobj img').length;
window.addEventListener('touchstart',function(e){
e.preventDefault();
first = 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;
}
}
first = x;
document.querySelectorAll('#tobj img')[step].style.display = 'block'
}
})
window.addEventListener('touchend',function(e){
e.preventDefault();
step = step;
})
Core streamline
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;
}
}
first = x;
document.querySelectorAll('#tobj img')[step].style.display = 'block'
}