Zooming
Zooming 是一款纯 javascript 图片缩放库,主要特点有:
- 不依赖其他库,纯 JavaScript 实现,支持移动设备;
- 流畅的动画;
- 可缩放高清图像;
- 易于集成和定制。
使用方法
1、引入文件
<script src="js/zooming.min.js"></script>
2、HTML
<a href="images/1.jpg">
<img class="img-zoomable" src="data:images/1s.jpg" alt="">
</a>或者使用 data 属性:
<img src="data:images/2s.jpg" data-action="zoom" data-original="images/2.jpg" alt="">
3、JavaScript
var zooming = new Zooming();
zooming.listen('.img-zoomable');配置
属性
名称 类型 默认值 说明 defaultZoomable 字符串 img[data-action=”zoom”] 缩放元素,可以是 css 选择器 enableGrab 布尔值 true 是否能够抓取移动 preloadImage 布尔值 true 是否预加载图片 transitionDuration 整数/小数 0.4 动画持续时间 transitionTimingFunction 字符串 cubic-bezier(0.4, 0, 0, 1) 动画函数 bgColor 字符串 rgb(255, 255, 255) 遮罩背景颜色 bgOpacity 整数/小数 1 遮罩透明度 scaleBase 整数/小数 1 缩放比例,默认为适应窗口大小 scaleExtra 整数/小数 0.5 抓取图像时额外缩放比例 scrollThreshold 整数 40 关闭前需要多少滚动 customSize null 缩放到指定的宽度和高度,如果设置该属性,将忽略 scaleBase 属性 onOpen null 放大后的回调函数 onClose null 关闭后的回调函数 onRelease null 松开后的回调函数 onBeforeOpen null 放大前的回调函数 onBeforeClose null 关闭前的回调函数 onBeforeGrab null 抓取前的回调函数 onBeforeMove null 移动前的回调函数 onBeforeRelease null 松开前的回调函数
演示地址:http://www.dowebok.com/demo/223/
GitHub 地址:https://github.com/kingdido999/zooming
Zooming的更多相关文章
- mouse scrollings and zooming operations in linux & windows are opposite
mouse scrollings and zooming operations in linux & windows are opposite. windows中, 鼠标滚动的方向是: 查看页 ...
- ion-scroll zooming="true" android端无法缩放的问题
很久很久没更新博客了,从今天开始决定以后陆续写一些博文,总结下自己在开发中碰到的问题. ionic项目.ion-scroll zooming="true" 在android端无法缩 ...
- 数字图像处理实验(4):PROJECT 02-04 [Multiple Uses],Zooming and Shrinking Images by Bilinear Interpolation 标签: 图像处理MATLAB
实验要求: Zooming and Shrinking Images by Bilinear Interpolation Objective To manipulate another techniq ...
- 数字图像处理实验(3):PROJECT 02-03, Zooming and Shrinking Images by Pixel Replication 标签: 图像处理matlab 20
实验要求: Zooming and Shrinking Images by Pixel Replication Objective To manipulate a technique of zoomi ...
- Zooming MKMapView to fit annotation pins
http://stackoverflow.com/questions/4680649/zooming-mkmapview-to-fit-annotation-pins - (MKCoordinateR ...
- pycharm Zooming in the Editor
https://www.jetbrains.com/help/pycharm/zooming-in-the-editor.html To enable changing font size in th ...
- JavaScript资源大全中文版(Awesome最新版)
Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...
- HTML5 网络拓扑图性能优化
HTML5 中的 Canvas 对文本的渲染(fillText,strokeText)性能都不太好,比如设置字体(font).文本旋转(rotation),如果绘制较多的文本时,一些交互操作会手动很大 ...
- 20个不可思议的 WebGL 示例和演示
WebGL 是一项在网页浏览器呈现3D画面的技术,有别于过去需要安装浏览器插件,通过 WebGL 的技术,只需要编写网页代码即可实现3D图像的展示.WebGL 可以为 Canvas 提供硬件3D加速渲 ...
随机推荐
- docker报错“net/http: TLS handshake timeout”的解决方法
为了永久性保留更改,您可以修改 /etc/docker/daemon.json 文件并添加上 registry-mirrors 键值. { "registry-mirrors": ...
- Mac Lion Configure Apache
mkdir ~/Sites echo "<html><body><h1>My site works</h1></body>< ...
- 微信公众号关联(小游戏 小程序 跳转 盒子 wx.navigateToMiniProgram)
参考: 公众号关联小程序 关联公众号 关联后,登录小游戏,可在设置-关联设置中看到关联的公众号 在小游戏中使用wx.navigateToMiniProgram wx.navigateToMiniPro ...
- JavaScript通知浏览器,更改通知数目
http://lab.ejci.net/favico.js/ http://www.zhangxinxu.com/study/201607/web-notifications.html http:// ...
- 在sublime中安装使用TortoiseSVN-sublime使用心得(4)
通过sublime text 2.0 安装 TortoiseSVN 插件. 和其它插件不同的是,安装成功后,重启sublime text 2.0 ,在Preferences->Package S ...
- windows本地启动tomcat闪退
da开cmd, 进入tomcat所在目录的bin目录: 执行startup.bat 查看设置的环境变量是否正确:如果不正确则在windows中设置正确的相关环境变量即可:
- Spring Framework框架容器核心源码逐步剖析
目录 构建Spring环境 Spring 版本 5.1.3.RELEASE 测试类 Spring 配置文件 测试方法Main 快速进入Debug查看IOC容器构建源码 Spring IOC源码步骤分析 ...
- Laravel 中的异常处理
这篇文章里,我们将研究 Laravel 框架中最重要也最少被讨论的功能 -- 异常处理. Laravel 自带了一个异常处理类,它能够让你以简单.优雅的方式 report 和 render 异常. 文 ...
- POJ-1952 BUY LOW, BUY LOWER(线性DP)
BUY LOW, BUY LOWER Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9244 Accepted: 3226 De ...
- 一个JS Class的“增删改查”
function AA (){ var r={}; this.get = function(key){ return r[key]; } this.put = function(key,x){ r[k ...