我为我的项目实施了以下 railscast:- http://railscasts.com/episodes/240-search-sort-paginate-with-ajax?view=asciicast。我也能够通过一些更改无缝地完成这项工作。现在,我正在尝试向我的每个产品元素添加幻灯片(使用 zurb-foundation 轮播)。我面临的问题是,当页面第一次加载时,幻灯片放映效果很好。但是,当我单击任何分页/排序/搜索链接时,幻灯片会转换为纯图像(未加载 jquery 组件)。
我不确定我错过了什么。
这是我的代码片段:-
Products.js
$("div.slideshow_list_page").orbit({animation: 'fade', // fade, horizontal-slide, vertical-slide, horizontal-push
animationSpeed: 800, // how fast animtions are
timer: false, // true or false to have the timer
resetTimerOnClick: false, // true resets the timer instead of pausing slideshow progress
advanceSpeed: 4000, // if timer is enabled, time between transitions
pauseOnHover: false, // if you hover pauses the slider
startClockOnMouseOut: false, // if clock should start on MouseOut
startClockOnMouseOutAfter: 1000, // how long after MouseOut should the timer start again
directionalNav: true, // manual advancing directional navs
captions: false, // do you want captions?
captionAnimation: 'fade', // fade, slideOpen, none
captionAnimationSpeed: 800, // if so how quickly should they animate in
bullets: true, // true or false to activate the bullet navigation
bulletThumbs: false, // thumbnails for the bullets
bulletThumbLocation: '', // location from this file where thumbs will be
afterSlideChange: function(){}, // empty function
fluid: true} );
应用程序.js
$(function () {
$('#products th a, #products .apple_pagination a').live('click', function () {
$.getScript(this.href);
return false;
});
});
products.html.erb
<td><div class="slideshow_list_page">
<%= image_tag "logo.png" %>
<%= image_tag "rails.png" %>
</div>
</td>
谢谢,阿米特