Javascript 3d investigation-based product display

Source: Internet
Author: User

This article mainly introduces the demonstration of javascript-implemented 3d investigation-based products. For more information, see

The javascript code of 3d object-by-detection image material is as follows: <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;}) The core simplified code is 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;} first = x; document. querySelectorAll ('# tobj img') [step]. style. display = 'block '}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.