jquery.panzoom

编程之家收集整理的这个编程导航主要介绍了jquery.panzoom编程之家,现在分享给大家,也给大家做个参考。

jquery.panzoom 介绍

Panzoom是一个渐进的插件来创建元素的平移和缩放功能。 panzoom需要jQuery1.9.0+或jQuery2.0+。IE<=8不支持。Panzoom支持包括iOS和Android的触摸手势,甚至支持捏缩放手势。它非常适合用于移动和桌面浏览器。Panzoom支持直接在浏览器平移和缩放SVG元素。

加载Panzoom

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

<script src="/js/plugins/jquery.panzoom.js"></script>

  或AMD方式

define([ "jquery","plugins/jquery.panzoom" ],function( $ ) {

$(document).ready(function() {

$(".panzoom-elements").panzoom();

});

});

Panzoom使用

$(".panzoom-elements").panzoom();

// Pass options

$("a.panzoom-elements").panzoom({

minScale: 0,

$zoomRange: $("input[type='range']")

});

Panzoom选项

Panzoom.defaults = {

// Should always be non-empty

// Used to bind jQuery events without collisions

// A guid is not added here as different instantiations/versions of Panzoom

// on the same element is not supported.

eventNamespace: ".panzoom",

// Whether or not to transition the scale

transition: true,

// Default cursor style for the element

cursor: "move",

// There may be some use cases for zooming without panning or vice versa

// NOTE: disablePan also disables focal point zooming

disablePan: false,

disableZoom: false,

// Pan only on the X or Y axes

disableXAxis: false,

disableYAxis: false,

// Set whether you'd like to pan on left (1),middle (2),or right click (3)

which: 1,

// The increment at which to zoom

// Should be a number greater than 0

increment: 0.3,

// When no scale is passed,this option tells

// the `zoom` method to increment

// the scale *linearly* based on the increment option.

// This often ends up looking like very little happened at larger zoom levels.

// The default is to multiply/divide the scale based on the increment.

linearZoom: false,

// Pan only when the scale is greater than minScale

panOnlyWhenZoomed: false,

// min and max zoom scales

minScale: 0.4,

maxScale: 5,

// The default step for the range input

// Precendence: default < html attribute < option setting

rangeStep: 0.05,

// Animation duration (ms)

duration: 200,

// css easing used for scale transition

easing: "ease-in-out",

// Indicate that the element should be contained within its parent when panning

// Note: this does not affect zooming outside of the parent

// Set this value to 'invert' to only allow panning outside of the parent element (the opposite of the normal use of contain)

// 'invert' is useful for a large Panzoom element where you don't want to show anything behind it

contain: false,

// Transform value to which to always reset (string)

// Defaults to the original transform on the element when Panzoom is initialized

startTransform: undefined,

// This optional jQuery collection can be set to specify all of the elements

// on which the transform should always be set.

// It should have at least one element.

// This is mainly used for delegating the pan and zoom transform settings

// to another element or multiple elements.

// The default is the Panzoom element wrapped in jQuery

// See the [demo](http://timmywil.github.io/jquery.panzoom/demo/#set) for an example.

// Note: only one Panzoom element will still handle events for a Panzoom instance.

// Use multiple Panzoom instances for that use case.

$set: $elem,

// Zoom buttons/links collection (you can also bind these yourself - e.g. `$button.on("click",function( e ) { e.preventDefault(); $elem.panzoom("zoom"); });` )

$zoomIn: $(),

$zoomOut: $(),

// Range input on which to bind zooming functionality

$zoomRange: $(),

// Reset buttons/links collection on which to bind the reset method

$reset: $(),

// For convenience,these options will be bound to Panzoom events

// These can all be bound normally on the Panzoom element

// e.g. `$elem.on("panzoomend",function( e,panzoom ) { console.log( panzoom.getMatrix() ); });`

onStart: undefined,

onChange: undefined,

onZoom: undefined,

onPan: undefined,

onEnd: undefined,

onReset: undefined

};

GitHub:https://github.com/timmywil/panzoom

网站描述:元素平移和缩放插件

jquery.panzoom

官方网站:

小编说

以上是编程之家为你收集整理的jquery.panzoom全部内容。

如果觉得编程之家网站内容还不错,欢迎将编程之家推荐给好友。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


jquery-labelauty,是一个基于 jQuery非常小巧的单选框复选框美化插件
jQuery.fontFlex,轻量级jQuery响应式字体插件
jQuery.Marquee,基于 jquery 实现的 marquee 无缝滚动插件
magnificent.js,一款响应式jQuery图片放大镜插件
Nestable,一个可拖拽的树结构表现插件
gridster.js,可拖放的多列网格布局
vegas,一个jQuery / Zepto幻灯片插件
jQuery-Knob,生成超酷的旋钮特效的jquery插件
Parallax.js,一款jQuery滚动视觉差插件
jquery.toast.js,一个向用户显示高度可定制的通知的插件
fakeLoader.js,十分炫酷的jQuery页面预加载Loading特效插件
OrgChart,一款简单实用的组织结构图表jQuery插件
jquery.danmu.js,jQuery弹幕插件
query-mousewheel,一个用于添加跨浏览器的鼠标滚轮支持的 jQuery 插件。
enlarge.js,一款支持移动手机的响应式jquery放大镜插件
jquery.fileDownload,实现ajax下载体验的jQuery插件
timeline.js,一款jQuery时间轴幻灯片插件
Uploadify,jQuery的一个上传插件( 支持批量上传)
cPager.js,基于jQuery的客服端分页插件
jTable,创建基于 AJAX 的增删改查表 jQuery 插件