2013-03-11 1 views
0

품질 및 기타 모든 코더 들께 안녕하세요. colorbox : 제목에 링크를 포함시키는 방법?

나는 사용자가 (zip 파일로) 고해상도의 버전을 다운로드 할 수 있도록 내가 제목에 링크를 포함하는 각 사진을 원하는

$(document).ready(function() 
     { 
     $(".gallery").colorbox({rel:'gallery', transition:"none", width:"95%", height:"95%"}); 
     }) 

    <a class="gallery" href="image.jpg" title="Click here to download hi-res version"><img src="imageThumbnail.jpg"></a> 

colorbox를 사용하여 간단한 갤러리를 ... 있습니다. zip 파일로 href를 설정하려고 시도했지만, 다음 사진으로 넘어갔습니다. colorbox 매개 변수를 통해 많은 옵션을 볼 수 있습니다. 그러나 어느 것이 가장 좋은 방법인지 알아 내기에는 충분하지 않습니다.

도움이 감사 할 것입니다 ... 감사합니다 !!

// ColorBox can accept a function in place of a static value: 
$("a.gallery").colorbox({rel: 'gal', title: function(){ 
    var url = $(this).attr('href'); 
    return '<a href="' + url + '" target="_blank">Open In New Window</a>'; 
}}); 

내가이 당신을 위해 무엇을 찾고있는 생각 : 제목에 대한 함수를 사용하는 예제가 colorbox homepage의 맨 위에 "사용"부분을 보면

답변

2

. 이 기능에서는 _blank 창에서 동일한 이미지가 아닌 zip 파일을 참조 할 수 있습니다. 그러나 이것은 당신을 가야합니다. 제목을 링크

분명히 http://www.jacklmoore.com/colorbox/faq#faq-titlelink

$('a.gallery').colorbox({title:function() { 
    return "To view full size, click here!".link(this.href); 
}}); 

이 링크 인수를 수정해야합니다,하지만 당신은 예를 들어 우리에게 충분한 정보를 제공하지 않은 :

0

그것은 ColorBox의 문서에의 .

2

나는 당신의 도움 덕분에 그것을 얻었습니다. Claude and isherwood ... 감사합니다!

$(document).ready(function(){ 
    $(".gallery").colorbox({rel:'gallery', transition:"none", width:"95%", height:"95%"}); 
}); 

$(document).ready(function(){ 
    $("a.gallery").colorbox({ 
     rel: 'a.gallery', 
     title: function(){ 
      var url = $(this).attr('name'); 
      var txt = $(this).attr('title'); 
      return txt+'<br /><a href="'+url+'" target="_blank">download hi-res (.tif.zip)</a>'; 
     } 
    }); 
}); 

과 HTML :

다음은 colorbox의 jQuery의

<a href="Image.jpg" class="gallery" name="Image.zip" title="Image"> 
    <img src="thumbnail/Image.jpg"> 
</a> 

YAY!

+0

감사합니다.이 친구도 저에게 효과적이었습니다. – Aaron