Posted by utzeri on February 27, 2009 at 3:34pm
Jump to:
| Project: | jQuery plugins |
| Version: | 6.x-1.5 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | utzeri |
| Status: | active |
Issue Summary
Hello, I'm new with Drupal. I'm trying to use Jquery plugins (for example Colorize - jQuery Table Plugin). Is there a complete example of integration Jquery plugins into a page? Where do I found it?
Thanks a lot Andrea
Comments
#1
You should look for contrib modules that use a jQuery plugin and see how they do it. One random example would be slideshow_creator. Usually it's just a matter of including the plugin in the page with a function like drupal_add_js() along with adding some custom javascript that uses the plugin
#2
mfb is right about using drupal_add_js() method to include your jquery plugins along with your other javascript files. The jquery.js file that comes with your drupal installation is found in /misc directory. Drupal bootstrap includes the jquery.js file for your so you only need to worry about including your jquery plugin in the right place. There are a few places where you can include your plugin such as a .info file, in your theme hooks and pages and in template.php file on the top of the page. There are pros and cons for each that I am still trying to get a good handle on. If you want a good resource, check out the book 'Pro Drupal Development' by by John K. VanDyk. It has a small chapter on jquery and AJAX integration. I just came across it this morning, it is very informative.
good luck