【问题标题】:ShareThis not working after installing Turbolinks gemShareThis 安装 Turbolinks gem 后不起作用
【发布时间】:2013-03-05 02:37:33
【问题描述】:

我最近安装了 turbolinks 和 jquery-turbolinks gem,现在我的 ShareThis 按钮不再像以前那样在单击时弹出。

我的 application.html.erb 头中目前有这些 ShareThis 脚本:

<script type="text/javascript">var switchTo5x=false;</script>
<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "eonwofenaoenf-oenfwoafneo-woenfowenfe"});</script>

这是我的 show.html.erb 页面上的代码:

<span class='st_sharethis_custom'></span>

感谢任何帮助。

【问题讨论】:

    标签: javascript jquery ruby-on-rails sharethis turbolinks


    【解决方案1】:

    我检查了 button.js 并找到了使它成为这种方式的方法。

    <script type="text/javascript">var switchTo5x=false;</script>
    <script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "eonwofenaoenf-oenfwoafneo-woenfowenfe"});</script>
    <script type="text/javascript">stLight && (stLight.readyRun = false)</script>
    

    span标签和你的一样。

    <span class='st_sharethis_custom'></span>
    

    但上述解决方案对于在 sharethis 方面对 button.js 工作流程的更改相当薄弱。

    因此,当您比较分享按钮与页面加载速度并通过分享按钮重要性赢得页面加载速度时,禁用 turbolinks 是一个很好的解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 2012-05-27
      • 1970-01-01
      相关资源
      最近更新 更多