2010-06-13 4 views
0

다음은 prettyphoto.js에서 수정해야하는 코드 섹션입니다. 내가 달성하고자하는 것은 각 사진에 사진에 대한 설명이 들어있는 숨겨진 div 또는 span이 있어야합니다. 이렇게하면 설명에 html을 포함시킬 수 있습니다.div 또는 span에서 제목을 가져 오지 않고 prettyphoto를 변경하십시오.

가능합니까?

감사합니다.

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; 

});

+0

원래 위의 코드를 변경하여 title 대신 longdesc 또는 alt를 가져 왔지만 설명에서 html을 얻을 수 없습니다. – Jason

+0

fancybox는 어떨까요? 가능합니까? http://www.copypastecode.com/30886/ – Jason

+0

내 솔루션을'.data() '를 사용해 보았습니까? 그것과 함께 무엇이든 저장하고 요소와 직접 연결할 수 있습니다. 귀하의 필요에 맞는 훌륭한 솔루션처럼 보일 것입니다. – user113716

답변

0

스팬이 이미지 바로 다음에 오는 한이 작업 (테스트되지 않음)이 작동해야합니다.

+0

나는 이것을 시도하고 prettyphoto 기능을 깨뜨렸다. – Jason

관련 문제