0
這是prettyphoto.js代碼段,我需要改變。 我想要實現的是每張照片都有一個隱藏的div或跨度,用於保存照片的描述。這樣我可以在描述中包含html。改變prettyphoto從div或跨度拉,而不是標題
可能嗎?
謝謝!
var images = new Array(), titles = new Array(), descriptions = new Array();
if(theGallery){
$('a[rel*='+theGallery+']').each(function(i){
if($(this)[0] === $(_self)[0]) setPosition = i; // Get the position in the set
images.push($(this).attr('href'));
titles.push($(this).find('img').attr('alt'));
descriptions.push($(this).attr('title'));
});
}else{
images = $(this).attr('href');
titles = ($(this).find('img').attr('alt')) ? $(this).find('img').attr('alt') : '';
descriptions = ($(this).attr('title')) ? $(this).attr('title') : '';
}
$.prettyPhoto.open(images,titles,descriptions);
return false;
});
我最初改變了上面的代碼來從longdesc或alt,而不是標題拉,但我仍然無法實現html中的描述。 – Jason 2010-06-13 16:34:55
fancybox怎麼樣 - 可能嗎? http://www.copypastecode.com/30886/ – Jason 2010-06-13 20:00:54
你用'.data()'來試試我的解決方案嗎?您可以存儲任何東西,並直接將其與元素相關聯。看起來像是一個很好的解決方案來滿足您的需 – user113716 2010-06-13 21:31:37