kossnocorp / jquery.turbolinks

💀 Deprecated ⚠️ jQuery plugin for drop-in fix binded events problem caused by Turbolinks
MIT License
1.01k stars 65 forks source link

Javascript plugins not working properly with turbolinks #65

Open tkristis opened 7 years ago

tkristis commented 7 years ago

I'm using share buttons (javascript plugins). When I open a page it shows that buttons, but when I open other page it disappear. It appear again when i refresh website. It working properly with jquery.turbolinks and without turbolinks gem, but without it website is very slow. How to make website faster? My website, now plugins is working, because I removed turbolinks.

application.js

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require lightbox
//= require_tree .
//= require turbolinks

application.html.erb javascript plugins

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-588e44a9401a6d9f"></script>
<script type="text/javascript" id="st_insights_js" src="http://w.sharethis.com/button/buttons.js?publisher=630cdfb3-b6c5-4da7-a389-1c7d5340827d"></script>
<script type="text/javascript">stLight.options({publisher: "630cdfb3-b6c5-4da7-a389-1c7d5340827d", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

Gemfile

gem 'jquery-turbolinks'
gem 'turbolinks', '~> 5.0.1'

I tried to add one plugin in javascript file, but result same

$(document).on('turbolinks:load', function(){
  stLight.options({publisher: "630cdfb3-b6c5-4da7-a389-1c7d5340827d",      doNotHash: false, doNotCopy: false, hashAddressBar: false});
});

Thank you for any help.

r3cha commented 7 years ago

62

In this issue find compatibility.coffee script and add to project

//= require jquery. 
//= require jquery.turbolinks. 
//= require jquery_ujs. 
//= require lightbox. 
//= require ....  
//= require_tree .  
//= require turbolinks. 
//= require turbolinks.compatibility.coffee