1

我有一个按钮栏,其中三个用于图像缩放和滚动,第四个是发送打印图像,通过库完成 panzoom 缩放和滚动,但是如果命令打印(发送成功)。现在如果我返回站点并且想要缩放,不要,我应该怎么做才能让我继续处理图像??

<section>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-md-12 btn-group">
                            <button type="button" class="zoom-in btn btn-default">
                                <span class="glyphicon glyphicon-zoom-in"></span>
                            </button>
                            <button type="button" class="zoom-out btn btn-default">
                                <span class="glyphicon glyphicon-zoom-out"></span>
                            </button>
                            <button type="button" class="reset btn btn-default">
                                <span class="glyphicon glyphicon-resize-full"></span>
                            </button>
                            <button name="printButton" id="printButton" type="button" class="btn btn-default" onclick="printDiv('printableArea')" runat="server">
                                <span class="glyphicon glyphicon-print"></span>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="panzoom">
                        <div id="printableArea">
                            <img src="img/descarga.jpg" alt="Visualización del original de la forma migratoria" class="img-responsive">
                             <script type="text/javascript">
                                 function printDiv(divName) {
                                     var printContents = document.getElementById(divName).innerHTML;
                                     var originalContents = document.body.innerHTML;
                                     document.body.innerHTML = printContents;
                                     window.print();
                                     document.body.innerHTML = originalContents;
                                 }
                        </script>
                        </div>   
                    </div>
                </div>
            </div>
            </section>

panzoom 的部分是

(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")
   });
   })();

带有按钮的图像

4

1 回答 1

1

我的解决方案是从 panzoom 重做所有事情,如下面的代码所示,但是我有一个问题,就像我定义的另一个函数中的函数调用一样,所以我保存了复制粘贴

function printDiv(divName) {
    var printContents = document.getElementById(divName).innerHTML;
    var originalContents = document.body.innerHTML;
    document.body.innerHTML = printContents;
    window.print();
    document.body.innerHTML = originalContents;
    window.onfocus = function () {
    window.close();
}
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")
});
};
于 2015-07-17T15:10:52.987 回答