如何使用zurb基础轨道滑块显示标题?

时间:2012-09-07 15:02:38

标签: javascript slider zurb-foundation captions orbit

我一直试图解决这个问题。任何建议/修复将不胜感激!

来源: my source

问题:字幕未显示

html(用于轨道滑块幻灯片):

<div><img class="art-work" src="art/2.png" alt="" data-caption="#htmlCaption1" /></div>
<div><img class="art-work" src="art/3.png" alt="" data-caption="#htmlCaption2" /></div>
<div><img class="art-work" src="art/4.png" alt="" data-caption="#htmlCaption3" /></div>

....等等

html(用于轨道滑块标题):

<span class="orbit-caption" id="htmlCaption1">Art #1</span>
<span class="orbit-caption" id="htmlCaption2">Art #2</span>
<span class="orbit-caption" id="htmlCaption3">Art #3</span>

......等等

html中的js:

<script type="text/javascript">
   $(window).load(function() {
        $('#featured').orbit({
            bullets: true,
            timer: false,
            captions: true,
            animation: 'fade' 
        });
   });
</script>   

1 个答案:

答案 0 :(得分:3)

这是因为你在'img'标签中有'data-caption'属性而不是包裹它的'div'。将其更改为以下内容,它应该可以正常工作

<div data-caption="#htmlCaption1"><img class="art-work" src="art/2.png" alt="" /></div>