2011-10-03 27 views
1

我使用jAlbum(與lightflow skin)爲我的網站創建照片庫。畫廊加載,並在一個不錯的輪播格式。我想添加錨點,這樣我可以直接鏈接到畫廊中的某張照片。我試圖在HTML中添加一個錨,但它不起作用。我認爲這是因爲當頁面加載畫廊需要幾秒鐘加載,因此不會重定向到錨點。我很容易出錯,需要一些建議來幫助錨點工作。下面是用於錨定的示例代碼和照片本身:我試圖鏈接到我插入所述錨(anchor3)和由相冊的(item8)插入id和既不工作在Javascript照片庫中插入錨點 - 不工作?

<div class="item"> 
    <a name="anchor3" id="anchor3"></a> 
     <img class="content hidden" src="thumbs/tree-w-sun.jpg" alt="Gifts" /> 
      <div class="ref hidden">item8</div> 
      <div class="caption"><h3>Gifts</h3></div> 
      <div class="comment hidden"></div> 
      <div class="author hidden"></div> 
      <div class="params hidden"></div> 
      <div class="info hidden"><div><p>Artist: UBhapE2</p></div></div> 
      <div class="thumbWidth hidden">261</div> 
      <div class="thumbHeight hidden">350</div> 
      <a id="item8" class="lightwindow hidden" title="<h3>Gifts</h3>" 
       rel="gal[cat]" href="slides/tree-w-sun.jpg" ></a> 
    </div> 

有控制的畫廊,並把他們在這裏的幾個腳本:

腳本1 - 「Lightflow JS」

var LightFlowGlobal = {}; 

function getParam(name){ 
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
var regexS = "[\\?&]"+name+"=([^&#]*)"; 
var regex = new RegExp(regexS); 
var results = regex.exec(window.location.href); 
if(results == null) 
    return ""; 
else 
    return results[1]; 
} 

腳本2 - 「ContentFlow JS」 這個js是長和空間起見,我把鏈接直接到JS file here

腳本3 - 這個腳本是在頁面:

<script language="JavaScript" type="text/javascript"> 
var startItem = getParam('p'); 
if(startItem == "") startItem = "first"; 
if(startItem.isNaN) startItem = "'"+startItem+"'"; 

new ContentFlow('contentFlow', { 
    reflectionColor: "#000000", 
    maxItemHeight: 350, 
    marginTop: 50, 
    reflectionHeight: 0.25, 
    endOpacity: 1, 
    startItem: startItem, 
    circularFlow: false, 
    stretchThumbs: false 
}); 


function lightWindowInit() { 
    LightFlowGlobal.myLightWindow = new lightwindow({ 
      infoTabName : "More Info", 
      rootPath: "res/lightwindow/", 
      loadingTxt: "loading or ", 
      cancelTxt: "cancel", 
      playTxt: "start slideshow", 
      stopTxt: "stop slideshow", 
      slowerTxt: "slower by 1 second", 
      fasterTxt: "faster by 1 second", 
     downloadSlideTxt: "Download", 
     downloadSlide: false, 
      showSlideshow: false, 
      slideshowDuration: 5000, 
     circular: false, 
     animationDuration: 0.25 
     }); 
} 
LightFlowGlobal.readyJS=true; 
var rootPath = "."; 

</script> 

我不確定需要其他腳本或CSS。我鏈接到我正在工作的測試庫with here if you需要查看頁面。如果需要,我會發布其他信息。

那麼現在我該如何獲得錨點來處理這個問題呢?在JavaScript中我不是那麼棒,所以請解釋一下答案vs「你需要將這個函數添加到腳本中」而不用解釋。

感謝您的任何和所有幫助!

+0

很抱歉,如果這是完全關閉基地,但乍一看你的錨標記實際上不是周圍的任何東西......它只是打開和關閉......這是故意的嗎? –

+0

@Dr。 Dredel - 不是故意的,但當我試圖將標籤包裹在照片的html周圍時,它會打破畫廊。 – L84

回答

0

我想出了一個辦法答案由照相館創世提供:

It's not only the js. You'd need to pass a parameter to AddThis in order to 
identify the image. Without it, you wouldn't know which image has been clicked. 
The best would be to use LightFlow's query paramter p=index, where index is the 
number of the image of the current web page. 
For example, the following link would focus the 4th image of the gallery 
(index begins at 0): http://your-domain.com/album/index.html?p=3 
1

ContentFlow網站上,在文檔 - >項目作爲鏈接下,開發者明確指出「項目內沒有元素可能包含任何錨點」。也許有人可以提供解決這個限制的方法。