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插件。
https://github.com/timmywil/jquery.panzoom如何限制Zoomout功能。我的意思是,我想放大图像到一定大小的图像,比如100 px。
Demo http://timmywil.github.io/jquery.panzoom/demo/#inverted-contain
我试过了演示版的Inverted containment within the parent element (to hide what's behind)。但对我来说不起作用。请帮帮忙。
发布于 2014-02-15 22:18:58
我知道这很古老,但是如果你玩minScale,你可以得到你喜欢的东西。您可以阅读自述文件的文档:
https://github.com/timmywil/jquery.panzoom/blob/master/README.md
发布于 2016-01-06 07:05:46
试试这个,这个会对你有用的
(function() {
var $section = $('section').first();
$section.find('.panzoom').panzoom({
increment: 0.3,
minScale: 0.8,
maxScale: 1.3
});https://stackoverflow.com/questions/19814607
复制相似问题