プロジェクトに次のレールキャストを実装しました:- 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>
ありがとう、アミット