-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get any javascript fucntions to work #201
Comments
I seem to be having a similar issue. The javascript for dropdown menu will work on initial page load, but will break (not re-initialize, I guess), when moving to another view... |
Cant get this gem to work with rails 5 |
@eliotc1986 It sounds like this is related to TurboLinks. Try adding Then modify your Foundation initialisation to:
|
@Dannyguk Thanks for your response, it seems like our problem was related to turbolinks like you say. For our project, we ended up removing the turbolinks from our application.html.erb page |
I made a new project without turbo links, still can't get java script to work |
I just dropped the Javascript lib because it doesn't work at all. Using only CSS right now. |
@kurko – there's no 'foundation' with type 'application/javascript' found in include paths. That's the problem (with Rails 5, at least), only 'foundation.js.es6' exist which Rails asset pipeline cannot load. |
Hi all - any progress on this? I've used Bower in Rails to wire this up in the past, and may look to fall back to that for now. |
In Rails 5.1 I get error "couldn't find file 'foundation' with type 'application/javascript' with turbolinks and without turbolinks. |
With the help of @bdesmarez I've gotten this resolved. I had to reorder and fine tune the order of loaded assets as below, and then change the $(document).on('turbolinks:load', function() as suggested by @Dannyguk I've included my entire application.js code below. You also have to add the jquery-turbolinks gem to your gemfile (and bundle install) On a related note, I believe that the foundation gem README could use a little work...as I found it a bit confusing, and if this is an issue after install it's possible the readme address correcting it by hand so that the framework actually works? (I'm a bit new to all of this, hopefully not overstepping.
|
I've dropped 'foundation-rails' usage for 'bin/yarn add foundation-sites' instead (Rails 5.1). |
Can you explain a little how you went about this? I'm fairly new to NPM, and javascript packages and using it with rails has be even more confused. I'd like to use the SASS version of foundation-sites so I can customize the _settings.scss file as needed. I'm also interested in trying to use style-sherpa that's included with foundation-sites to create a living style guide for our rails app. We're running on an old rails app, but it's just been upgraded to 5.1.2. |
The instructions of @jeremyawhitman don't seem to do the trick for me. Generally, Foundation works out of the box for me and I noticed that it does all the JS work required. I just needed to add the following to my application.scss to make it work.
|
Hello, |
Railsa 6.0.3 I had an issue with some of my javascript not working. I'm working for someone right now (beginner) and I'm building the back-end of a website with someones front end template coded in html/css and javscript imports. I'm using bootstrap along with general.js and jquery-3.4.1. My problem was that some of my javascript would load but some wouldn't, in fact some of the modals(drop downs) for other features wouldn't load. Also, the javascript in question(nav bar) would work on initial load, but when I rendered another view(redirect) the nav bar would not work. It was frustrating because there weren't any errors. Heres what I did and I hope it helps: First take a good look at your application.js structure, some files may be dependent of one another. For instance my jquery and boostrap files were dependent of general. I also did:
I have my javascript set up through application.js as rails should have it and my application.js file looks like this:
I first got my nav bar to start working when I removed the .start() from turbolinks require. I don't know why it worked, but that seems to be the problem. Also have this in my webpack.config (this helped me fix an issue with jquery not being loaded directly) I had an error in my inspect for this:
|
I've been struggling to get this and Foundation 6 working in a rails 5 app for over a day now, I can't get it to display any menus properly. Any help is appreciated.
The text was updated successfully, but these errors were encountered: