A Web developer🎯 from China.
- 🔭 I’m currently working on NextJS, React, Canvas.
- 🌱 I’m currently learning ...
移动端手势缩放图片 适用于文章中图片放大缩小查看
License: MIT License
需修改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开发版下测试通过
图片缩放时,不是居于屏幕中心,导致了一些宽大高小的图片,在手势捏合的时候,图片容易跑到屏幕外,松开手势后才再次回到屏幕中心。
以及必须两个手指同时在图片上才可以缩放,尺寸较小的图片很难两个手指同时在图片上。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.