私は自分のWebページでクラシックテーマのガレリア画像ギャラリー( http://galleria.io/ )を使用しています。ユーザーをフルスクリーンモードにするボタンを追加したかったのです。それで、私はAPIを調べましたが、それは単純に見えました。私は2、3回試し、最終的にそれを機能させることができました。重要なのは、最初にhtmlドキュメントを開いたときは完全に機能しますが、フルスクリーンモードを閉じて(escを押すか、十字をクリックして)、もう一度開こうとすると(リンク先のリンクをクリックして)、動作しません。開こうとしているように見えますが、何かが止まっています。1秒ほど表示されるからです。なぜこれが起こるのか分かりませんが、誰かがここで私を助けてくれますか?
私のhtml:
<style>
.content{width:700px;height:800px;margin:20px auto;}
#galleria{height:700px}
</style>
<!-- load jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<!-- load Galleria -->
<script src="../../galleria-1.2.8.min.js"></script>
</head>
<body>
<div class="content">
<!-- the link for fullscreen mode -->
<a id="fullscreen" href="#"> fullscreen </a>
<div id="galleria">
<!-- and then all the images just like they were when opening the classic theme demo html -->
</body>
そして私のJavaScript:
<script>
Galleria.ready(function() {
var gallery = this;
gallery.attachKeyboard({
left: gallery.prev,
right: gallery.next,
});
$("#fullscreen").click(function() {
gallery.enterFullscreen();
});
});
// Initialize Galleria
Galleria.run("#galleria")
// Load the classic theme
Galleria.loadTheme('galleria.classic.min.js');
</script>