我正在尝试将照片大拇指附加到图库(因为它只显示一张大图像),所以我已经加载(使用.load)画廊,一切正常(画廊正确显示),但我想要的是只显示大图像的拇指。相反,当我尝试切换它切换所有的拇指,所以如果我写
$("#one").slideToggle('medium');
$("#two").slideToggle('medium');
$("#three").slideToggle('medium');
$("#four").slideToggle('medium');
没关系,所有的拇指都在那里 但如果我写
$('div[align=center]:eq(1)').append('<br /><a class="linkone" href="#">Show Gallery</a><div id="one" name="one"></div><div id="two" name="two"></div><div id="three" name="three"></div><div id="four" name="four"></div>');
$("#one").hide();
$("#two").hide();
$("#three").hide();
$("#four").hide();
$(".linkone").click(function(event) {
event.preventDefault();
var bigimage = $('.forumrow table').find('img:first').attr('src').split(/medium/)[1]; //this is the big image
var linkfilter = $('.blockhead a').filter('a[href^="http://www.site.com/showgallery.php?cat="]').attr('href').split(/=/)[1]; //this is the category gallery http://www.site.com/showgallery.php?cat= 123
var thumb = "http://www.site.com/data/" + linkfilter + "/thumbs" + bigimage; // this is the thumb if the big image
if ($('#one .forumrow table img[src="' +thumb+ '"]'))
{
$("#one").slideToggle('medium');
}
或者如果我写
$('div[align=center]:eq(1)').append('<br /><a class="linkone" href="#">Show Gallery</a><div id="one" name="one"></div><div id="two" name="two"></div><div id="three" name="three"></div><div id="four" name="four"></div>');
$("#one").hide();
$("#two").hide();
$("#three").hide();
$("#four").hide();
$(".linkone").click(function(event) {
event.preventDefault();
var bigimage = $('.forumrow table').find('img:first').attr('src').split(/medium/)[1]; //this is the big image
var linkfilter = $('.blockhead a').filter('a[href^="http://www.site.com/showgallery.php?cat="]').attr('href').split(/=/)[1]; //this is the category gallery http://www.site.com/showgallery.php?cat= 123
var thumb = "http://www.site.com/data/" + linkfilter + "/thumbs" + bigimage; // this is the thumb if the big image
if (bigimage == thumb)
{
$("#one").slideToggle('medium');
}
这是错误的,因为它总是显示相同的拇指库,所以我如何管理如果有一张大照片,如果我点击显示图库,它只切换大照片的图库?