Mobile finger Zoom Out plug-in and source code

Source: Internet
Author: User

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">    <Metaname= "Apple-mobile-web-app-capable"content= "Yes">    <Metaname= "Apple-mobile-web-app-status-bar-style"content= "BLACK">    <title>Scaling</title>    <style>#box{width:100px;Height:100px;background:Red;}Html,body{width:100%;Height:100%;Overflow:Hidden;}    </style>    <Script>Document.addeventlistener ('domcontentloaded',function() {                varC=1;//first define an initial value                varOBox=document.getElementById ('Box'); Document.addeventlistener ('Touchstart',function(EV) {//Hand pointing under                    varOLDC=C;//Put the initial value inside the OLDC .                   functionGetC (EV) {varX1=ev.targettouches[0].pagex; varY1=ev.targettouches[0].pagey;//two finger scaling is sure to require two fingers, "0" the XY coordinates of the first finger                       varX2=ev.targettouches[1].pagex;//the coordinates of the second finger                       vary2=ev.targettouches[1].pagey; vara=X1-x2;//The first finger of the pagex-second finger of the Pagex, so exactly is a triangle between a two right-angled edge;                       varb=Y1-Y2;//Ibid .                       returnMath.sqrt (A*a+b*b)//known two square edges open squared to draw bevel edges                   }                   if(Ev.targetTouches.length==2){//to determine if it's two fingers , put the initial value of the oblique foot on the point of the two finger to the DOWNC.                       varDOWNC=GetC (EV); } document.addeventlistener ('Touchmove',function(EV) {//when your fingers move,                       if(Ev.targetTouches.length==2){//determine if it's two fingers when moving.C=GetC (EV)/DOWNC+OLDC;//At this time the getc (EV) is the move time, with the value of the trailing edge of the oblique foot in addition to the value of not moving, plus his initial value,OBox.style.webkitTransform='Scale ('+C+')';//scale----2D Zoom conversion                       }                   },false)                },false)            },false)    </Script></Head><Body>    <DivID= "box"></Div></Body></HTML>

Mobile finger Zoom Out plug-in and source code

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.