下拉仅触发一次 [英] dropdowns only trigger once
问题描述
我在此网站上有两个过滤器下拉菜单,这只会在我第一次按时触发他们。根据我的研究,它似乎与涡轮链接有关,我通过向body标签添加data-no-turbolink来禁用turbolink,如下所示:
I have two filter dropdowns on this site which will only trigger the first time I press them. According to my studies it seems that it has to do with turbolinks, which I've disabled by adding data-no-turbolink to the body tag like so:
<body data-no-turbolink>
...
</body>
我也试着将其添加到所有下拉链接和打开下拉列表的链接中。
I've also tried adding this to all of the dropdown links and the link to open the dropdown.
<a href="some-link" data-no-turbolink>...</a>
它似乎适用于开发,但是当我推到Heroku时,似乎turbolinks再次运行。任何建议?
It seems to work on development, but when I push to Heroku, it seems turbolinks are running again. Any suggestions?
推荐答案
如果Turbolinks存在问题,可以按照提供的说明从项目中完全删除。 此处:
If Turbolinks is an issue, it can be removed entirely from the project by following the instructions provided e.g. here:
- 从Gemfile中删除
gem'turbolinks'
并运行code
- 从 app / assets / javascripts / application.js中移除
// = require turbolinks
strong> - 删除
data-turbolinks-track=> application.html标头中的
标签.erb 布局文件。样式表
和javascript
标签的真
- remove
gem 'turbolinks'
from the Gemfile and runbundle update
- remove
//= require turbolinks
from app/assets/javascripts/application.js - remove
"data-turbolinks-track" => true
from thestylesheet
andjavascript
tags in the header of application.html.erb layout file.
引用 Rails 4 In Action :
...我们认为Turoblinks非常适合加速
主要服务器端网站,但只要您开始编写一些
JavaScript,它会导致更多的问题,而不是它的价值。
...it's our opinion that Turoblinks is great to speed up mostly-server-side sites, but as soon as you start writing some JavaScript, it causes more problems than it's worth.
这篇关于下拉仅触发一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!