缩放-如何禁用拖动选项



在rails 4.2.2项目中,我使用panzoom jquery作为html元素(而不是图像),对于同一页面,我使用annotator插件。现在的问题是注释器不工作,因为我无法选择页面中的任何单词。整个html是移动(拖拽),因为panzoom,我怎么能禁用'拖拽'选项?

由http://www.jqueryscript.net/zoom/jQuery-Plugin-For-Panning-Zooming-Any-Elements-panzoom.html引用

视图,

<div class="buttons">
  <button class="zoom-in btn btn-default btn-xs">+ Zoom In</button>
  <button class="zoom-out btn btn-default btn-xs">- Zoom Out</button>
  <button class="reset btn-sm btn btn-primary">Reset</button>
</div>
<div class="panzoom" style="height: 480px;">
  <%= render :file => @path %>
</div>
$(".panzoom").panzoom({
 $zoomIn:    $(".zoom-in"),
 $zoomOut:   $(".zoom-out"),
 $zoomRange: $(".zoom-range"),
 $reset:     $(".reset")
});

使用disablePan选项:

$section.find('.panzoom').panzoom({
  disablePan: true,
  $zoomIn: $section.find(".zoom-in"),
  $zoomOut: $section.find(".zoom-out"),
  $zoomRange: $section.find(".zoom-range"),
  $reset: $section.find(".reset")
});

最新更新