1
我在我的網頁上使用經典主題的環球免稅店圖片庫(http://galleria.io/)。 我想添加一個按鈕,使用戶進入全屏模式。所以,我看了一下這個API,它看起來很簡單:我嘗試了幾次,最後纔開始工作。 問題是:第一次打開html文檔時效果很好,但當我關閉全屏模式時(通過按Esc或單擊十字),然後嘗試再次打開它(通過單擊鏈接到的鏈接)它不起作用。它看起來像試圖打開,但有些東西阻止它,因爲它顯示了一秒鐘。 我不知道爲什麼會發生這種情況,有人可以幫我嗎?Galleria API enterFullscreen只在頁面加載時才起作用
我的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>