Home > Web Front-end > JS Tutorial > JavaScript 3D Zhuzhen Product Display (Core Simplification)_Javascript Skills

JavaScript 3D Zhuzhen Product Display (Core Simplification)_Javascript Skills

WBOY
Release: 2016-05-16 16:54:24
Original
1148 people have browsed it

3d 逐侦图片 素材

javascript 部分代码

复制代码 代码如下:

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(xstep ;
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;
})

核心精简
复制代码 代码如下:

if(Math.abs(x - first)>10){
document.querySelectorAll('#tobj img')[step].style.display = 'none'
if(xstep ;
if(step>=lth-1){
step =0
}
}else{
step--
if(step<=0){
step = lth-1;
}
}
first = x;
document.querySelectorAll('#tobj img')[step].style.display = 'block'
}
Related labels:
3d
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template