我正在添加免费的 w3layout 模板,javascript 在 rails 4.2 应用程序中运行两次
I'm adding a free w3layout templates and javascript runs twice in rails 4.2 app
我正在向我的新 rails 4.2 应用程序添加一个免费的 w3layout 模板 Link to template,当我将所有文件放在它们的位置时,似乎 javascript 事件 运行s 两次。当您重新加载页面 (F5) 时,它是可见的。
我认为原因 - 是下面的代码和 turbolinks。但如果没有它,事件 运行 会立即发送到模板的所有部分。问题是——我如何才能顺利地将这些 .js 文件管理到 运行 一次。我不太擅长javascript。
<!--animate-->
<script>
new WOW().init();
</script>
<!--//end-animate-->
我放入的所有js文件app/assets/javascript
这是我认为所有问题所在的 link to full github project. And this is application.html.erb。本地应用 运行s。
我找到了解决方案。问题不在
<!--animate-->
<script>
new WOW().init();
</script>
<!--//end-animate-->
原因在这段代码中
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/bootstrap.js"></script>
它在模板的末尾,所以我没有立即看到它。
我正在向我的新 rails 4.2 应用程序添加一个免费的 w3layout 模板 Link to template,当我将所有文件放在它们的位置时,似乎 javascript 事件 运行s 两次。当您重新加载页面 (F5) 时,它是可见的。
我认为原因 - 是下面的代码和 turbolinks。但如果没有它,事件 运行 会立即发送到模板的所有部分。问题是——我如何才能顺利地将这些 .js 文件管理到 运行 一次。我不太擅长javascript。
<!--animate-->
<script>
new WOW().init();
</script>
<!--//end-animate-->
我放入的所有js文件app/assets/javascript
这是我认为所有问题所在的 link to full github project. And this is application.html.erb。本地应用 运行s。
我找到了解决方案。问题不在
<!--animate-->
<script>
new WOW().init();
</script>
<!--//end-animate-->
原因在这段代码中
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/bootstrap.js"></script>
它在模板的末尾,所以我没有立即看到它。