JavaScriptを使い慣れていないので、私はこの問題を回避するのに問題があります。JavaScriptのメソッドの値を変更
メソッドの値を切り替えるonclickイベントを作成しようとしています。私はOpenSeadragonを使用していると私は、この現在のonclickのように設定している:
viewer.world.getItemAt(1).setOpacity(0);
私はHTMLでボタンを押すと、私はsetOpacityを必要とする(0)0と1の間に切り替えるには、この層を明らかにする私はOpenSeadragonでセットアップしました。レイヤーは.getItemAt(1)に反映されます。コードはhttp://web.stanford.edu/~cmalex/woelのページへのリンクです。すべてのヘルプは大歓迎です
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name = "viewport" content = "user-scalable = no">
<title>Wonder of Everyday Life</title>
<link rel="stylesheet" href="styles/normalize.css/normalize.css" type="text/css" media="screen">
<link rel="stylesheet" href="styles/main.css" type="text/css" media="screen">
<script src="scripts/jquery.min.js"></script>
</head>
<body>
<div id="header">
<h1 class="museum">Cantor Arts Center</h1>
<h1><a href="javascript:history.go(0)" class="show">Restart</a></h1>
</div>
<div id="subheader">
<h2>The Wonder of Everyday Life</h2>
<p>Dutch Golden Age Prints</p>
</div>
<div id="openseadragon"></div>
<div id="instructions">
<p>Pinch and Zoom or use controls</p>
</div>
<div id="footer">
<div id="toolbar">
<a id="zoom_in" href="#zoom_in"></a>
<a id="zoom_out" href="#zoom_out"></a>
<a id="reset" href="#reset"></a>
<a id="view" onclick="viewer.world.getItemAt(1).setOpacity(0);"></a>
</div>
</div>
<script src="scripts/openseadragon.min.js"></script>
<script type="text/javascript">
var viewer = OpenSeadragon({
id: "openseadragon",
prefixUrl: "scripts/images/",
tileSources: "openseadragon/map.dzi",
opacity: 1,
zoomInButton: "zoom_in",
zoomOutButton: "zoom_out",
homeButton: "reset",
showNavigator: true,
navigatorPosition: "ABSOLUTE",
navigatorTop: "10px",
navigatorLeft: "10px",
navigatorHeight: "145px",
navigatorWidth: "125px",
visibilityRatio: 1.0,
constrainDuringPan: true
});
viewer.addTiledImage({
tileSource: "openseadragon/overlay.dzi",
index: 1
});
</script>
</body>
</html>
:
はここで完全なコードです!
株式コード、あなたのonclickのユーザーが作成したイベントとあなたがそれをクリックすると、あなたのコンソールで取得したエラーを書いてください、あなたの問題 –
を説明します。またレイヤーによってオーバーレイを意味しますか? – Icewine
こんにちは@Akshaypadwal。上記のコードを更新しました。ご協力いただきありがとうございます。もう情報が必要な場合はお知らせください! – cmalexander