diff --git a/app/assets/javascripts/theater.js b/app/assets/javascripts/theater.js index a76d656..b396fe5 100644 --- a/app/assets/javascripts/theater.js +++ b/app/assets/javascripts/theater.js @@ -4,6 +4,7 @@ $('.show-gallery .show-content.col-sm-2').ready(function(){ } }) window.GalleryTheater = function(){ + bindKeyHandlers(); var parent_divs = $('.gallery').parents('div'), parent_div_z_index = parent_divs.eq(parent_divs.length-1).css('z-index') parent_divs.eq(parent_divs.length-1).css('z-index','2000') @@ -103,18 +104,18 @@ window.GalleryTheater = function(){ var bindHandler = function(){ // handler to close the theater - gt.closeBtn.on("click",gt.destroyTheater); + gt.closeBtn.off('click').on("click",gt.destroyTheater); // handler to show theater - $("div[data-list=images] a").on("click",function(){ + $("div[data-list=images] a").off('click').on("click",function(){ gt.createTheater($(this).attr("href")); return false; }) - gt.switchBtn.on("click",gt.switchTheme); - gt.descriptionToggle.on("click", gt.toggleDescription) - gt.stripPrevBtn.on("click", gt.scrollStripRight); - gt.stripNextBtn.on("click", gt.scrollStripLeft); + gt.switchBtn.off('click').on("click",gt.switchTheme); + gt.descriptionToggle.off('click').on("click", gt.toggleDescription) + gt.stripPrevBtn.off('click').on("click", gt.scrollStripRight); + gt.stripNextBtn.off('click').on("click", gt.scrollStripLeft); if(Modernizr.touch){ gt.imageContainer.swipe({ @@ -190,10 +191,10 @@ window.GalleryTheater = function(){ } gt.createTheater = function(link){ + $('.gallery-img-desc').removeClass('active'); gt.stage.show(); $("body").addClass("gallery-mode-on"); - bindKeyHandlers(); - gt.isTheaterInitialized = false; + gt.isTheaterInitialized = false; if(!gt.isTheaterInitialized){ $.ajax({ url : link,