Javascript and Ruby on rails

I’m learning on creating a website using Ruby on Rails (RoR). I had an
template that I created when I worked with JSP 2 years ago, and now I
to reuse it in my RoR website. This is HTML file

        <li><a href="#">Outdoor</a></li>


<script type="text/javascript" src="js/jquery.Nav.js"></script>

<script type="text/javascript">

and this is the javascript file jquery.Nav.js

(function($) {
 left : currentPageItem.position().left,
// mouse out
reset = setTimeout(function() {
width : currentPageItem.outerWidth(),
left : currentPageItem.position().left
}, options.speed)
}, options.reset);
}); // end each

In the application.html.erb of RoR project, I include the js file like

  <%= javascript_include_tag "jquery.Nav.js" %>

However, my homepage doesn’t work even though I put the $(’#nav’).spasticNav(); inside the body
of RoR project



Is there anyway to embed the $(’#nav’).spasticNav() into the js file. I
tried many ways but it still doesn’t work. Thanks a lot.

EDIT: I saw some examples online that they embed the function into js
like this.

Are you getting any errors in the javascript console?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs