2011-04-21 125 views
1

我有一個相冊,其中我有旋轉圖像與分頁。我想在圖像下方顯示標題,標題也應隨圖像更改而改變。旋轉圖像標題與圖像

我寫了下面的HTML代碼

<div class="slider_box"> 
    <div align="left" id="slider2" class="sliderwrapper"> 
     #IMG# 
    </div> 
    <div id="paginate-slider2" class="pagination"></div> 
</div> 
<span class="slider_box"> 
    <span align="left" id="slider" class="sliderwrapper"> 
     #CAPTION# 
    </span> 
</span> 


<script> 
featuredcontentslider.init({ 
    id: "slider2", 
    //id of main slider DIV 
    contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"] 
    //toc: "<img src=images/dot_white.jpg align=absmiddle border=0>", //Valid values: "#increment", "markup", ["label1", "label2", etc] 
    toc: " &nbsp;&nbsp;", 
    nextprev: ["", ""], //labels for "prev" and "next" links. Set to "" to hide. 
    revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover" 
    enablefade: [true, 0.1], //[true/false, fadedegree] 
    autorotate: [true, 6000], //[true/false, pausetime] 
    onChange: function(previndex, curindex){ //event handler fired whenever script changes slide 
     //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc) 
     //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc) 
    } 
}) 

featuredcontentslider.init({ 
    id: "slider", 

    //id of main slider DIV 
    contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"] 

    //toc: "<img src=images/dot_white.jpg align=absmiddle border=0>", //Valid values: "#increment", "markup", ["label1", "label2", etc] 
    toc: " &nbsp;&nbsp;", 
    nextprev: ["", ""], //labels for "prev" and "next" links. Set to "" to hide. 
    revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover" 
    enablefade: [true, 0.1], //[true/false, fadedegree] 
    autorotate: [true, 6000], //[true/false, pausetime] 
    onChange: function(previndex, curindex){ //event handler fired whenever script changes slide 
     //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc) 
     //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc) 
    } 
})</script> 

這樣做的問題是,所有圖像的字幕一起下方不旋轉的圖片.. :(

回答

0

顯示沒有看到其餘的代碼,我會認爲你有一個滑塊,並有此

<span align="left" id="caption"> 

#CAPTION# 

</span> 

var captions["Caption for image1", "Caption for image2"] 

,改變你的腳本的onChange部分

onChange: function(previndex, curindex){ 
//event handler fired whenever script changes slide 
//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc) 
//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc) 
document.getElementById("caption").innerHTML=captions[curindex]; 
}