Saturday, January 7, 2012

[Rails] including jQuery library

Hi. I have started Rails a few days ago.
With the help of a book (written in Japanese), I'm working on a tutorial
program which simply shows how to include jQuery file.

Rails version 3.1.3

According to the book, there must be a directory

public/javascript

but there isn't after launching a new project. But I finally found the
directory

app/assets/javascript

so I copied jquery.js and rails.js in there.

and in "application.rb"

config.action_view.javascript_expansions[:defaults] = %w(jquery
rails)

and in "application.html.erb"

<!DOCTYPE html>
<html>
<head>
<title>OnlineDictionary</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>
</body>
</html>

and finally in" test.html.erb"

<img id="logo" src="http://www.wings.msn.to/image/wings.jpg" />
<script type="text/javascript">
$('#logo').fadeOut(3000);
</script>

so if success, it should fade out the image. It shows the image but it
does not fade out. It does not work at
all.

Could anyone point out the mistake(s) I presumably made?

soichi

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate