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加速渲 ...
随机推荐
- cout快捷转换进制
cout<<hex<<i<<endl; //输出十六进制数 cout<<oct<<i<<endl; //输出八进制数 cout& ...
- [Apio2008]免费道路[Kruscal]
3624: [Apio2008]免费道路 Time Limit: 2 Sec Memory Limit: 128 MBSec Special JudgeSubmit: 1292 Solved: ...
- HP P2xxx/MSA SMI-S Provider
HP P2xxx/MSA SMI-S Provider The HP MSA provider must be enabled before it can be monitored. For more ...
- 【CF720D】Slalom 扫描线+线段树
[CF720D]Slalom 题意:一个n*m的网格,其中有k个矩形障碍,保证这些障碍不重叠.问你从(1,1)走到(n,m),每步只能往右或往上走,不经过任何障碍的方案数.两种方案被视为不同,当且仅当 ...
- Elasticsearch 自定义映射
尽管在很多情况下基本域数据类型 已经够用,但你经常需要为单独域自定义映射 ,特别是字符串域.自定义映射允许你执行下面的操作: 全文字符串域和精确值字符串域的区别 使用特定语言分析器 优化域以适应部分匹 ...
- ActiveMQ延迟消息配置
ActiveMQ使用延迟消息,需要在activemq.xml配置文件中添加这项: schedulerSupport="true" <broker xmlns="ht ...
- NuGet 安装EntityFramework5 历程
第一步:VS2012中 (据说VS2010还得安装一下NuGet)工具->库程序包管理器->程序包管理器控制台,打开控制台 Install-Package EntityFramework ...
- 【紫书】Undraw the Trees UVA - 10562 递归,字符串
题意:给你画了一颗树,你要把它的前序输出. 题解:读进到二维数组.边解析边输出. 坑:少打了个-1. #define _CRT_SECURE_NO_WARNINGS #include<cstri ...
- python面向对象高级:Mixin多重继承
继上一篇学习笔记:python面向对象的继承与多态,本篇就Mixin扩展类的方法写下学习笔记 Mixin Mixin编程是一种开发模式,是一种将多个类中的功能单元的进行组合的利用的方式,这听起来就像是 ...
- python3学习笔记(2)_list-tuple
# !/usr/bin/env python3 # -*- coding:utf-8 -*_ #list 和 tuple #list 是有序集合,可以用索引(下标)访问lsit中的每一个元素 #最后一 ...