我想要一个用于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>