HTML 和 Javascript
<section>
<h1>Panning and zooming with CSS3</h1>
<div class="parent">
<div class="panzoom">
<img src="image1" width="400" height="400">
</div>
</div>
<div class="buttons">
<button class="zoom-in">Zoom In</button>
<button class="zoom-out">Zoom Out</button>
<input type="range" class="zoom-range">
<button class="reset">Reset</button>
</div>
<script>
(function() {
var $section = $('section').first();
$section.find('.panzoom').panzoom({
$zoomIn: $section.find(".zoom-in"),
$zoomOut: $section.find(".zoom-out"),
$zoomRange: $section.find(".zoom-range"),
$reset: $section.find(".reset")
});
})();
</script>
</section>
我正在使用 Pan Zoom 插件。
https://github.com/timmywil/jquery.panzoom
如何限制缩小功能。我的意思是我想将图像缩小到图像的特定大小,例如 100 像素。
演示 http://timmywil.github.io/jquery.panzoom/demo/#inverted-contain
我已经Inverted containment within the parent element (to hide what's behind)
从演示中尝试过。但对我来说它不起作用。请帮忙。