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加速渲 ...
随机推荐
- vue生成路由实例
一.vue路由https://router.vuejs.org/zh-cn/1.bower下载vue-routervue的里的链接 <router-link to="/home&quo ...
- 3-2 axios基础介绍
1.静态引用 <script src="https://unpkg.com/axios/dist/axios.min.js"></script> 2.npm ...
- 23种设计模式之策略模式(Strategy)
策略模式是一种对象的行为型模式,定义一系列算法,并将每一个算法封装起来,并让它们可以相互替换.策略模式比算法独立于使用它的客户而变化,其目的是将行为和环境分隔,当出现新的行为时,只需要实现新的策略类. ...
- JIRA - 使用指南(项目跟踪管理工具)
第一章.前言 JIRA 是澳大利亚 Atlassian 公司开发的一款优秀的问题跟踪管理软件工具,可以对各种类型的问题进行跟踪管理,包括缺陷.任务.需求.改进等.JIRA采用J2EE技术,能够跨 ...
- wpgcms---列表页数据渲染
列表页的数据,都是放到 contentList 这样的一个变量里面. {% for x in contentList %} <dl> <dt><a href=" ...
- Shell if else
语句1if [ expression ]then ...fi 语句2if [ expression ]then ...else ...fi 语句3if [ expression 1 ]then ... ...
- Java-查询已创建了多少个对象
//信1603 //查询创建了多少个对象//2017.10.19public class Lei {//记录对象个数 ;//生成一个对象就自加加 public Lei() { x++; }public ...
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
- Mayor's posters---poj2528线段树、离散化
题目链接:http://poj.org/problem?id=2528 题意:有n张海报要贴,每张需要用的区间为L到R,后面的可以贴在之前的上面,就是吧之前的挡住,求最后我们能看到几张海报: 我们可以 ...
- (3.10)mysql基础深入——mysqld 服务器与客户端连接过程 源码分析【待写】
(3.10)mysql基础深入——mysqld 服务器与客户端连接过程 源码分析[待写]