2012-05-03 31 views
0

我正嘗試使用任何簡單的jQuery幻燈片演示,其中圖像和文本將動態顯示。jQuery + Rails 3.1中的動態幻燈片演示

Rails代碼是這樣的:

.section 
    [email protected] do |testimonial| 
     .section 
      .row.testimonial.round 
       .three.columns 
        =image_tag(testimonial.testifier.thumb_small.url)   
       .eight.columns.testimonial-description 
        .row.testimonial-description 
         %blockquote 
          %span(class = "bqstart") &#8220 
          =testimonial.description 
          %span(class = "bqend") &#8221 
        .row.testifier-details 
         %strong="#{testimonial.name} #{testimonial.designation} #{testimonial.company}" 
       .one.columns 

這會給我從數據庫中的圖像和說明。

如果我想將這些結果放在幻燈片中,我該如何解決?

回答

0

這件事從來沒有與Zurb軌道(幻燈片)合作。我切換到slide.js這是一個更好的幻燈片IMO和它的工作。

ass/assets/javascript此安裝slides.js之後是幻燈片中的HTML: -

.section 
    #testimonial-slideshow.round 
     [email protected] do |testimonial| 
      .row 
       .three.columns 
        =image_tag(testimonial.testifier.thumb_small.url)   
       .nine.columns 
        .row.testimonial-description 

         %span(class = "bqstart") &#8220 
         =truncate(testimonial.description, :length => 150) 
         %span(class = "bqend") &#8221 
        .row.testimonial-name 
         %strong="#{testimonial.name} #{testimonial.designation} #{testimonial.company}" 

和JS如下: -

$('#testimonial-slideshow').slides({ 
      width: 600, 
      height: 120, 
      generateNextPrev: false, 
      pagination: false, 
      play: 1000 
    });