0

我想要一个用于ReferenceStrip的切换按钮(属性:showReferenceStrip)。即使变量在运行时更新,它也不会在视觉上更新。有什么方法可以更新吗?

<html>
<button id="toggleRefStrip">Toggle Preview</button>

    <div id="osd-container" style="width: 950px; height: 1200px;"></div>
        <script src="openseadragon/openseadragon.min.js"></script>
        <script type="text/javascript">
        var toggleRefStripBtn = document.getElementById("toggleRefStrip");
        toggleRefStripBtn.addEventListener("click",function(e){
            if(viewer.showReferenceStrip === true) { viewer.showReferenceStrip = false;}
            else {viewer.showReferenceStrip = true;}
            console.log("viewer.showReferenceStrip: " + viewer.showReferenceStrip);
        });
            var viewer = OpenSeadragon({
                crossOriginPolicy: 'Anonymous',
                visibilityRatio: 1.0,
                showRotationControl: true,
                defaultZoomLevel: 1.6,
                minZoomImageRatio: 0.4,
                //zoomPerScroll: 1, //deactivate mouse/finger zooming
                id: "osd-container",
                tileSources: ["images/T/1.dzi", "images/T/2.dzi", "images/T/3.dzi", "images/T/4.dzi"],
                sequenceMode: true,
                showReferenceStrip: false,
            });
        </script>    
</html>
4

1 回答 1

1

看起来没有直接在 OSD 中的功能(尽管您当然可以提交问题或制作补丁来添加这样的东西)。似乎您可以使用以下方式隐藏 referenceStrip:

viewer.referenceStrip.element.style.display = 'none';

...并显示:

viewer.referenceStrip.element.style.display = 'block';
于 2017-04-14T16:52:15.130 回答