首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jquery.panzoom、jQuery:包含问题

jquery.panzoom、jQuery:包含问题
EN

Stack Overflow用户
提问于 2015-03-31 12:21:22
回答 1查看 392关注 0票数 1

我真的很难让contain选项在jquery.panzoom上工作。

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

无论出于什么原因,我都无法将图像拖过整个容器DIV的整个区域。这是我的用法示例。

http://dev.specialopswatch.com/products-page/predators/silver-predator/

标记:

代码语言:javascript
复制
    <section id="contain">

        <div class="panzoom-parent" style="overflow: hidden; position: relative;">

            <img class="panzoom" src="http://dev.specialopswatch.com/wp-content/uploads/2014/06/SILVER-PREDATOR-400x4001.png" width="400" height="400" style="transform: matrix(0.5, 0, 0, 0.5, 0, 5); backface-visibility: hidden; transform-origin: 50% 50% 0px; cursor: move; transition: none; -webkit-transition: none;">

        </div>

    </section>

Javascript:

代码语言:javascript
复制
    jQuery(document).ready(function($) {

        $section = $("#my-zoom");
        var $panzoom = $section.find('.panzoom').panzoom({
            $zoomIn: $section.find(".zoom-in"),
            $zoomOut: $section.find(".zoom-out"),
            $zoomRange: $section.find(".zoom-range"),
            $reset: $section.find(".reset"),
            startTransform: 'scale(0.95)',
            maxScale: 1.3,
            increment: 0.1,
            contain: true,                      
        }).panzoom('zoom', true);

    });

请帮帮我!

EN

回答 1

Stack Overflow用户

发布于 2016-01-22 20:52:52

请尝试使用disablePan: false

代码语言:javascript
复制
 jQuery(document).ready(function($) {
    $section = $("#my-zoom");
    var $panzoom = $section.find('.panzoom').panzoom({
        $zoomIn: $section.find(".zoom-in"),
        $zoomOut: $section.find(".zoom-out"),
        $zoomRange: $section.find(".zoom-range"),
        $reset: $section.find(".reset"),
        startTransform: 'scale(0.95)',
        maxScale: 1.3,
        disablePan: false,
        increment: 0.1,
        contain: true,                      
    }).panzoom('zoom', true);

});

这对我很管用

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29360561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档