Holder.js doesn't work with turbolinks

断了今生、忘了曾经 提交于 2019-12-24 17:02:24

问题


Holder.js doesn't work with turbolinks.

I'm getting empty images.

It works when i press Ctrl+R.

How to get them work together?


回答1:


Use this script to run holder.js between requests:

$(document).bind 'page:change', ->
  Holder.run()



回答2:


For Rails 5 I had to use this:

document.addEventListener('turbolinks:load', function() {
    Holder.run()
});

See https://stackoverflow.com/a/18770589/1845011 and https://github.com/turbolinks/turbolinks#installing-javascript-behavior



来源:https://stackoverflow.com/questions/18304213/holder-js-doesnt-work-with-turbolinks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!