2010-06-23 28 views
2

我的頁面上有一個Galleriffic幻燈片。現在,「大」圖片鏈接到幻燈片中的下一張圖片。我怎樣才能讓它鏈接到外部文件呢?Galleriffic鏈接

回答

10

首先,你要隱藏的div或span標籤添加到您的無序列表:

<li> 
    <a class="thumb" href="/imageurl/image.gif">imageititle</a> 
    <span id="project-path" style="display:none;">example_path</span> 
</li> 

然後,該代碼添加到您的galleriffic.js文件。你是從span元素抓住了路徑:

addImage: function(listItem, thumbExists, insert, position) { 
        var $li = (typeof listItem === "string") ? $(listItem) : listItem;     
        var $aThumb = $li.find('a.thumb'); 
       ** var $path = $li.find('#project-path'); 
       ** var projectPath = $path.text(); 
        var slideUrl = $aThumb.attr('href'); 
        var title = $aThumb.attr('title'); 
        var $caption = $li.find('.caption').remove(); 
        var hash = $aThumb.attr('name'); 

然後,你的價值添加到圖像變量:

  var imageData = { 
     **  projectPath:projectPath, 
       title:title, 
       slideUrl:slideUrl, 
       caption:$caption, 
       hash:hash, 
       gallery:this, 
       index:position 
      }; 

現在告訴畫廊改變對全鏈接瓦特/新路徑-size圖庫圖片:

  // Construct new hidden span for the image 
      var newSlide = this.$imageContainer 
       .append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="/project/'+imageData.projectPath+'" title="'+imageData.title+'">&nbsp;</a></span>') 
       .find('span.current').css('opacity', '0'); 

這裏註釋掉畫廊的點擊動作,使您的用戶可以只使用正常的鏈接包裹的圖像:

     newSlide.find('a') 
       .append(imageData.image) 
       //.click(function(e) { 
        //gallery.clickHandler(e, this); 
       //}) 
       ; 
+0

謝謝你這麼多,我會嘗試這一點,並讓你知道我是如何得到的 – user374557 2010-06-23 19:34:13

+0

謝謝你,這是。非常有幫助和工作。 – 2011-05-06 13:03:36

+0

它也幫助我:) – 2012-07-06 12:13:10

0

是的 - 在http://prestondentalgroup.com.au/downloads.html 幻燈片圖像上的超鏈接允許查看器打開/保存PDF文檔。 很好地工作(一旦我解密瞭如何編寫example_path並用PDF文件的URL替換/ project /包含子文件夾) 所以要從站點的images/downloads /文件夾鏈接到readme.pdf, example_path變成了圖像/downloads/readme.pdf
和 /項目/ HTTP變成:/prestondentalgroup.com.au/