diff --git a/app/assets/javascripts/theater.js b/app/assets/javascripts/theater.js
index c86af10..39dfbf3 100644
--- a/app/assets/javascripts/theater.js
+++ b/app/assets/javascripts/theater.js
@@ -269,16 +269,6 @@ window.GalleryTheater = function() {
currentPic.image = albumData.images[0];
currentPic.index = 0;
setMainPic();
- isTheaterInitialized = false;
- setTimeout(function() {
- loadingProcess = 0;
- nextPicLoading = 0;
- $('.theaterButton').remove()
- $("img.gallery-image.gal-prev.gal-inactive").remove();
- img = $("img.gallery-image.gal-active");
- img.eq(0).remove();
- window.onhashchange()
- }, 100)
}
}
}
@@ -439,32 +429,33 @@ window.GalleryTheater = function() {
if (direction == null) {
if (img.length==0){
img = $("");
+ img.hide();
imageContainer.append(img);
+ img.one("load", function() {
+ one_load(img)
+ })
}
- img.hide();
img.attr("src", currentPic.image.file.theater.url);
img.attr("alt", currentPic.image.alt_title);
- img.one("load", function() {
- one_load(img)
- })
isTheaterInitialized = true;
} else {
if (selectedFromStrip) {
- img = imageContainer.find(".gal-" + direction);
img.attr("src", currentPic.image.file.theater.url);
img.attr("alt", currentPic.image.alt_title);
+ }else{
+ if (direction == "next") {
+ imageContainer.find(".gal-prev").remove();
+ img.removeClass("gal-active").addClass("gal-prev gal-inactive temp");
+ imageContainer.find(".gal-next").removeClass("gal-inactive gal-next").addClass("gal-active");
+ thumbStrip.css("left", (parseInt(thumbStrip.css("left")) - 66) + "px");
+ } else if (direction == "prev") {
+ imageContainer.find(".gal-next").remove();
+ img.removeClass("gal-active").addClass("gal-next gal-inactive temp");
+ imageContainer.find(".gal-prev").removeClass("gal-inactive gal-prev").addClass("gal-active");
+ thumbStrip.css("left", (parseInt(thumbStrip.css("left")) + 66) + "px");
+ }
}
- if (direction == "next") {
- imageContainer.find(".gal-prev").remove();
- img.removeClass("gal-active").addClass("gal-prev gal-inactive temp");
- imageContainer.find(".gal-next").removeClass("gal-inactive gal-next").addClass("gal-active");
- thumbStrip.css("left", (parseInt(thumbStrip.css("left")) - 66) + "px");
- } else if (direction == "prev") {
- imageContainer.find(".gal-next").remove();
- img.removeClass("gal-active").addClass("gal-next gal-inactive temp");
- imageContainer.find(".gal-prev").removeClass("gal-inactive gal-prev").addClass("gal-active");
- thumbStrip.css("left", (parseInt(thumbStrip.css("left")) + 66) + "px");
- }
+
mainPicLoading = 1;
}
descriptionArea.html("
" + currentPic.image.description + "
"); @@ -544,6 +535,7 @@ window.GalleryTheater = function() { }) } else { nextPicLoading = 1; + $("img.gallery-image.gal-next.gal-inactive").remove(); } } @@ -563,6 +555,7 @@ window.GalleryTheater = function() { }) } else { prevPicLoading = 1; + $("img.gallery-image.gal-prev.gal-inactive").remove(); } }