From 38cc9fbc8b45f8726a0c165ac7b033a1465fdd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 24 Sep 2022 13:22:58 +0800 Subject: [PATCH] fix error --- app/assets/javascripts/theater.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/theater.js b/app/assets/javascripts/theater.js index 785485e..324f0bb 100644 --- a/app/assets/javascripts/theater.js +++ b/app/assets/javascripts/theater.js @@ -40,12 +40,15 @@ window.GalleryTheater = function() { button_play_string = '', button_stop_string = '', playtimeoutID; - var initialize = function() { + var set_margin = function () { if ($('#orbit-bar').height()>0){ //for show page $('#gallery-theater-stage>.gallery').css('margin-top','2.4em') }else{ $('#gallery-theater-stage>.gallery').css('margin-top','') } + } + var initialize = function() { + set_margin(); stage = $("#gallery-theater-stage"); closeBtn = stage.find(".gallery-close"); switchBtn = stage.find(".gallery-theme-switch"); @@ -559,7 +562,10 @@ window.GalleryTheater = function() { $(document).ready(function() { initialize(); - }) + }); + $(window).load(function() { + set_margin(); + }); } // gallery-image gal-prev gal-inactive \ No newline at end of file