随图像旋转图像标题
Rotating image caption with the images
我有一个图片库,其中我有旋转图像与分页。我想在图像下面显示一个标题,标题也应该随着图像的变化而变化。
我写了以下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: " ",
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: " ",
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>
这样做的问题是所有图像的标题都显示在不旋转的图像下面。(
没有看到你的代码的其余部分,我认为你有一个滑块和这个
<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];
}
相关文章:
- 将图像标题存储在selenium IDE中
- 用Javascript替换图像和图像标题/alt文本
- 如何在 javascript 替换新图像/标题后正确显示 css 工具提示
- 将鼠标悬停在图像上时删除图像标题
- 将图像标题区域与图像对齐
- 根据图像标题的搜索输入过滤图像
- 纸夹头像显示图像标题,而不是图像
- 在javascript弹出窗口中显示图像标题
- 单击更改图像标题的Javascrript
- PHP如何更改/添加图像标题
- Wordpress媒体库使用wp.media访问图像标题
- 显示已更改的图像标题
- NyroModal:将图像标题置于底部
- PHP图像标题输出显示
- 获取图像标题,并在当前URL的末尾添加链接
- 更改SRC +图像标题
- 灯箱中的图像标题/注释
- 使用这个.检索图像标题
- 不寻常的Javascript图像标题错误
- 随图像旋转图像标题