
下载: zoom-master
项目地址: https://github.com/jackmoore/zoom
Compatible with: jQuery 1.7+ in Chrome, Firefox, Safari, Opera, Internet Explorer 7+.
Install via NPM
npm install jquery-zoom
Instructions
Zoom appends html inside the element it is assigned to, so that element has to be able to accept html, like <a>, <span>, <li>, <div>, etc. This excludes <img> elements (see below).
// Example:
$(document).ready(function(){
$('a.photo').zoom({url: 'photo-big.jpg'});
});
// Using Colorbox with Zoom
$(document).ready(function(){
$('a.photo').zoom({
url: 'photo-big.jpg',
callback: function(){
$(this).colorbox({href: this.src});
}
});
});
To use zoom with img elements, they will need to be wrapped with another element. It is impossible to read some layout related CSS styles from JavaScript (percent-based width and height, margins set to auto, etc.) so the safe thing to do is to defer this change to individual site owners. The following is all that is needed in some cases:
$(document).ready(function(){
$('img')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom();
});
Removing Zoom
Trigger the zoom.destroy event to remove zoom from an element:
$('#example').zoom(); // add zoom
$('#example').trigger('zoom.destroy'); // remove zoom
Settings
| Property | Default | Description |
|---|---|---|
| url | false | The url of the large photo to be displayed. If no url is provided, zoom uses the src of the first child IMG element inside the element it is assigned to. |
| on | 'mouseover' | The type of event that triggers zooming. Choose from mouseover, grab, click, or toggle. |
| duration | 120 | The fadeIn/fadeOut speed of the large image. |
| target | false | A selector or DOM element that should be used as the parent container for the zoomed image. |
| touch | true | Enables interaction via touch events. |
| magnify | 1 | This value is multiplied against the full size of the zoomed image. The default value is 1, meaning the zoomed image should be at 100% of its natural width and height. |
| callback | false | A function to be called when the image has loaded. Inside the function, `this` references the image element. |
| onZoomIn | false | A function to be called when the image has zoomed in. Inside the function, `this` references the image element. |
| onZoomOut | false | A function to be called when the image has zoomed out. Inside the function, `this` references the image element. |
原文: http://www.jacklmoore.com/zoom/
本文: jQuery Zoom 图片聚焦或者点击放大A plugin to enlarge images on touch, click, or mouseover
jQuery Zoom:图片放大效果实现
jQuery Zoom是一个用于在触摸、点击或鼠标悬停时放大图片的插件,兼容Chrome, Firefox, Safari, Opera和IE7+。安装可通过NPM,适用于`<div>`, `<a>`, `<img>`等元素,不适用于`<input>`元素。当需要使用在`<input>`元素上时,需要包裹其他元素。可以通过触发`removeZoom`事件来移除插件效果。"
111991342,10396416,理解与配置VLAN:从交换机到路由器,"['网络', '交换机配置', '路由器配置', 'VLAN路由', 'DHCP']

被折叠的 条评论
为什么被折叠?



