Fotorama jQuery 图库 Rails 4.2.0(Turbolinks 问题)
Fotorama jQuery Gallery with Rails 4.2.0 (Turbolinks issue)
我有 Fotorama jQuery Slider working; however, it doesn't work with Turbolinks(我不想禁用 Turbolinks)。
如何在通过 Turbolinks 加载它所在的页面时加载此 jQuery 滑块?
在 application.js
中,我得到了以下处理 Turbolinks 的代码:
var ready;
ready = function() {
// JavaScript to be triggered by Turbolinks/page:load event
};
$(document).ready(ready);
$(document).on('page:load', ready);
我可以在 JavaScript 的这一部分添加一个功能来加载 Fotorama 滑块吗?
任何 ideas/feedback 感谢。
提前致谢。
是的。
我从未使用过这个 Fotorama
滑块,但查看它的文档我认为你可以做到这一点
$(document).on('ready page:load',function(){
$('.fotorama').fotorama();
});
我推荐JQuery-Turbolinksgem。我自己用。只需将其添加到 Gemfile 中,捆绑更新即可。
我有 Fotorama jQuery Slider working; however, it doesn't work with Turbolinks(我不想禁用 Turbolinks)。
如何在通过 Turbolinks 加载它所在的页面时加载此 jQuery 滑块?
在 application.js
中,我得到了以下处理 Turbolinks 的代码:
var ready;
ready = function() {
// JavaScript to be triggered by Turbolinks/page:load event
};
$(document).ready(ready);
$(document).on('page:load', ready);
我可以在 JavaScript 的这一部分添加一个功能来加载 Fotorama 滑块吗?
任何 ideas/feedback 感谢。
提前致谢。
是的。
我从未使用过这个 Fotorama
滑块,但查看它的文档我认为你可以做到这一点
$(document).on('ready page:load',function(){
$('.fotorama').fotorama();
});
我推荐JQuery-Turbolinksgem。我自己用。只需将其添加到 Gemfile 中,捆绑更新即可。