Javascript and Ruby on rails

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

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

src=“http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js”>

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

<script type="text/javascript">
    $('#nav').spasticNav();
</script>
</body>
</html>

and this is the javascript file jquery.Nav.js

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

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

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

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

<body>
</script>

</body>

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
file
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