I seem to be unable to make comments upon previous answers.
@xanadont, after noticing curious behavior I realized that (y)our solution, specifically the first line, is actually pulling in the image that opens by default in the .ngg-imagebrowswer div. Which unfortunately always loads the same image and therefore converts that same file path to the same flv. What we need to do is pull the href from the click event. Like so:
var img = $(this).attr('href');
var convertToFLV = img.attr("src");
if (convertToFLV != undefined) {
convertToFLV = convertToFLV.replace(/\.jpg$/i, ".flv");
}
Which to me makes at least moderate sense to me. But not to Javascript.
EDIT: I've done more digging and figured out the solution.
Essentially, I need to grab the click src of the thumbnail being selected, put that into ConvertToFLV, and call it inside the url wrap.
Full code below:
$(function() {
$('.vid-gallery-thumbnail a').click(function() {
newFLV = $(this).attr('href');
var convertToFLV = $(this).attr('href');
if (convertToFLV != undefined) {
convertToFLV = convertToFLV.replace(/\.jpg$/i, ".flv");
}
$('.ngg-imagebrowser').fadeOut('slow', function(){
$('.ngg-imagebrowser').css({ height: $(".ngg-imagebrowser img").height() });
$('.ngg-imagebrowser img').wrap('<a href="' + convertToFLV + '"></a>').attr({ src: newFLV }).css({ margin: "0", visibility: "hidden" }).show();
$('.ngg-imagebrowser').animate({ height: $(".ngg-imagebrowser img").height() },'slow', function(){
$('.ngg-imagebrowser img').css({ visibility: "visible", display: "none" }).fadeIn('slow');
});
});
return false;
});
});
EDIT: Additional problems have cropped up.
Clicking on the first video thumbnail brings up the proper URL. Clicking subsequent thumbs brings up a clone of the same URL. Revised code for style is below:
$(function() {
$('.ngg-gallery-thumbnail a').click(function() {
newImg = $(this).attr('href');
$(function(){
$('.ngg-imagebrowser img').attr({ src: newImg }).css({ margin: "0", visibility: "hidden" }).show();
$('.ngg-imagebrowser').animate({ height: '650px;' }, 'slow', function(){
$('.vid-imagebrowser div').hide(); // Hide video div
$('.ngg-imagebrowser div').show(); // Show image div
$('.ngg-imagebrowser img').css({ visibility: "visible", display: "none" }).fadeIn('slow');
});
});
return false;
});
$('.vid-gallery-thumbnail a').click(function() {
newFLV = $(this).attr('href');
var convertToFLV = $(this).attr('href');
if (convertToFLV != undefined) {
convertToFLV = convertToFLV.replace(/\.jpg$/i, ".flv");
}
$(function(){
$('.vid-imagebrowser img').wrap('<a href="' + convertToFLV + '"></a>').attr({ src: newFLV }).css({ margin: "0", visibility: "hidden" }).show();
$('.vid-imagebrowser').animate({ height: '650px;' },'slow', function(){
$('.ngg-imagebrowser div').hide(); // Hide image div
$('.vid-imagebrowser div').show(); // Show video div
$('.vid-imagebrowser img').css({ visibility: "visible", display: "none" }).fadeIn('slow');
});
Anarchy.FLV.go(); //recall An-Arcos script
});
return false;
});
});
** FINAL EDIT: Problem solved!**
$(function() {
$('.ngg-gallery-thumbnail a').click(function() {
$('div.vid-imagebrowser span').remove();
newImg = $(this).attr('href');
$('.ngg-imagebrowser img').attr({ src: newImg }).css({ margin: "0", visibility: "hidden" }).show();
$('.ngg-imagebrowser').animate({ height: '650px;' }, 'slow', function(){
$('.vid-imagebrowser div').hide(); // Hide video div
$('.ngg-imagebrowser div').show(); // Show image div
$('.ngg-imagebrowser img').css({ visibility: "visible", display: "none" }).fadeIn('slow');
});
return false;
});
$('.vid-gallery-thumbnail a').click(function() {
$('div.vid-imagebrowser span').remove();
newFLV = $(this).attr('href');
var convertToFLV = $(this).attr('href');
if (convertToFLV != undefined) {
convertToFLV = convertToFLV.replace(/\.jpg$/i, ".flv");
}
$('.ngg-imagebrowser div').hide(); // Hide image div
$('.vid-imagebrowser img').attr({ src: newFLV })
$('.vid-imagebrowser a').attr({ href: convertToFLV }).css({ margin: "0", visibility: "hidden" }).show();
$('.vid-imagebrowser').animate({ height: '650px;' },'slow', function(){
$('.ngg-imagebrowser div').hide(); // Hide image div
$('.vid-imagebrowser div').show(); // Show video div
$('.vid-imagebrowser object').css({ visibility: "visible", display: "none" }).fadeIn('slow');
});
Anarchy.FLV.go(); //recall An-Arcos script
return false;
});
});