Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Javascript plugins not working properly with turbolinks #65

Open
tkristis opened this issue Feb 19, 2017 · 1 comment
Open

Javascript plugins not working properly with turbolinks #65

tkristis opened this issue Feb 19, 2017 · 1 comment

Comments

@tkristis
Copy link

tkristis commented Feb 19, 2017

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
Copy link

r3cha commented Sep 9, 2017

#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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants