【问题标题】:How to get captions to display with zurbs foundation's orbit slider?如何使用 zurb 基础轨道滑块显示字幕?
【发布时间】:2026-02-17 18:20:04
【问题描述】:

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

来源: 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>   

【问题讨论】:

    标签: javascript slider zurb-foundation captions orbit


    【解决方案1】:

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

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

    【讨论】: