0

我正在使用轨道来满足幻灯片放映要求,但是我无法添加字幕。

文档是这样说的:-

<div id="featured"> 
     <img src="overflow.jpg" alt="Overflow: Hidden No More" />
     <img src="captions.jpg"  alt="HTML Captions" data-caption="#htmlCaption" />
     <img src="features.jpg" alt="and more features" />
</div>
<!-- Captions for Orbit -->
<span class="orbit-caption" id="htmlCaption">I'm A Badass Caption</span>

我正在使用haml并做这样的事情:-

.container
    .row
        .two.columns
            =render "left_navigation"
        .ten.columns.destination_tabs
            .contianer
                .row
                    .ten.columns
                        %h3 Featured Destination
                        %hr
                        -if @preferred.blank?
                            %h5 No Featured destinations currently
                        -else
                            #featured
                                -@preferred.each do |destination|
                                    -destination.destination_photos.each do |photo|
                                        =image_tag(photo.picture.thumb_large.url, :alt =>"html captions", :data-caption => "#htmlCaption")

.orbit-caption#htmlCaption
    ="sfsdf"

这显然会产生错误,因为我无法给出像:data-caption我尝试了很多东西但无法正确使用的语法,但有人可以帮忙吗?

4

1 回答 1

2

您可以通过简单地引用任意字符串作为符号:

:"data-caption" => "#htmlCaption" #note the quotes around data-caption
于 2012-03-16T17:03:25.860 回答