Git Product home page Git Product logo

touch-scale-img's Introduction

Hi there

A Web developer🎯 from China.

  • 🔭 I’m currently working on NextJS, React, Canvas.
  • 🌱 I’m currently learning ...

github stats

touch-scale-img's People

Contributors

onlyhom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

touch-scale-img's Issues

代码有几处不兼容现目前的移动端浏览器

需修改touch_scale_image.js的几处代码:
document.addEventListener("touchmove", self.eventStop, false);改为document.addEventListener("touchmove", self.eventStop, { passive: false });

document.removeEventListener("touchmove", self.eventStop, false);改为
document.removeEventListener("touchmove", self.eventStop, { passive: false });

y1 = e.touches[0].pageY - document.body.scrollTop;
y2 = e.touches[1].pageY - document.body.scrollTop;

改为

y1 = e.touches[0].pageY - (document.body.scrollTop + document.documentElement.scrollTop);
y2 = e.touches[1].pageY - (document.body.scrollTop + document.documentElement.scrollTop);

修改后的代码在Chrome,360极速浏览器,UC开发版下测试通过

有点问题哎

图片缩放时,不是居于屏幕中心,导致了一些宽大高小的图片,在手势捏合的时候,图片容易跑到屏幕外,松开手势后才再次回到屏幕中心。
以及必须两个手指同时在图片上才可以缩放,尺寸较小的图片很难两个手指同时在图片上。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.