From a3d2a6f6be41f248954c2ef2e47e82fbc9d3f4c6 Mon Sep 17 00:00:00 2001 From: Michael Toppa Date: Sat, 5 Oct 2013 20:51:12 -0400 Subject: [PATCH] Bug fix: get Fancybox working in Firefox; For caption overlays on thumbnails, have them fade-in after they are fully positoned, so you don't see their position and size adjusting as the page loads. --- public/display/shashin.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/public/display/shashin.js b/public/display/shashin.js index 7cab10b..1c85b11 100755 --- a/public/display/shashin.js +++ b/public/display/shashin.js @@ -14,6 +14,21 @@ jQuery(document).ready(function($) { return decodeURIComponent(results[1].replace(/\+/g, " ")); } + function setShashinFancyBoxCaption(currentArray, currentIndex, currentOpts) { + var link = currentArray[ currentIndex ]; + var linkId = $(link).attr('id'); + var linkIdParts = linkId.split('_'); + var captionId = '#shashinFancyboxCaption_' + linkIdParts[1] + + if (linkIdParts[2]) { + captionId = captionId + '_' + linkIdParts[2]; + } + + this.title = $(captionId).html(); + this.title = this.title.replace('', ''); + this.title = this.title + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + ''; + } + if (shashinJs.imageDisplayer == 'prettyphoto') { // The "-0" and "!!" below are for type casting, as all vars brought over // from wp_localize_script come in as strings @@ -73,22 +88,6 @@ jQuery(document).ready(function($) { } } - // made this a separarte function as it is used below as well - function setShashinFancyBoxCaption(currentArray, currentIndex, currentOpts) { - var link = currentArray[ currentIndex ]; - var linkId = $(link).attr('id'); - var linkIdParts = linkId.split('_'); - var captionId = '#shashinFancyboxCaption_' + linkIdParts[1] - - if (linkIdParts[2]) { - captionId = captionId + '_' + linkIdParts[2]; - } - - this.title = $(captionId).html(); - this.title = this.title.replace('', ''); - this.title = this.title + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + ''; - } - var fancyboxInterval = shashinJs.fancyboxInterval - 0; if (fancyboxInterval > 0) { @@ -266,7 +265,7 @@ jQuery(document).ready(function($) { } else { - $shashinCaption.css('display', 'block'); + $shashinCaption.css('visibility','visible').hide().fadeIn('slow'); } } }