Skip to content

Commit

Permalink
Bug fix: get Fancybox working in Firefox; For caption overlays on thu…
Browse files Browse the repository at this point in the history
…mbnails, have them fade-in after they are fully positoned, so you don't see their position and size adjusting as the page loads.
  • Loading branch information
Michael Toppa committed Oct 6, 2013
1 parent 3f50438 commit a3d2a6f
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions public/display/shashin.js
Expand Up @@ -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('<!-- comment for image counter --></div>', '');
this.title = this.title + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
}

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
Expand Down Expand Up @@ -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('<!-- comment for image counter --></div>', '');
this.title = this.title + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
}

var fancyboxInterval = shashinJs.fancyboxInterval - 0;

if (fancyboxInterval > 0) {
Expand Down Expand Up @@ -266,7 +265,7 @@ jQuery(document).ready(function($) {
}

else {
$shashinCaption.css('display', 'block');
$shashinCaption.css('visibility','visible').hide().fadeIn('slow');
}
}
}
Expand Down

0 comments on commit a3d2a6f

Please sign in to comment.