简体   繁体   中英

How do I add jQuery 'tinycarousel' plugin in Rails app

I have to use jQuery plugin 'tinycarousel' in my Rails app.

I have added the plugin in

vendor/assets/javascripts

I also added in application.js

//= require jquery.tinycarousel.min

In my html file i did:

 <script type="text/javascript">
          $(document).ready(function(){
              $('.contract-notification').tinycarousel();
          });
 </script>

When I execute this in my browser I got error which tells

 Undefined is not a function. 

ie It cannot recognize .tinycarousel()

What am I doing wrong?

Also when I check my Resources in browser I could not find tinycarousel plugin. It is not loaded. What should I do to load this plugin also?

Thanks to all your valuable comments.

I just added

  <script type="text/javascript" **src="/assets/jquery.tinycarousel.min.js"**>
          $(document).ready(function(){
              $('.contract-para').tinycarousel();
              $('.contract-notification-close').click(function(){
                  $('.contract-notification').hide();
              });

          });
      </script>

and I got it working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM