Adding jquery to views output

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by styles24 on February 17, 2010 at 6:58pm

I am interested in installing this jquery function: http://desandro.com/demo/masonry/ to my taxonomy terms page, which is being displayed by views, I have already added the .js file to my .info theme file. The javascript loads fine, but I seem to be lost on where I should put the

$('#primary').masonry({
columnWidth: 100,
itemSelector: '.box'
});
for example.
I've already tried placing the code in the output of the views field but the effect still doesn't work. What do I seem to be missing or doing wrong?

Comments

Hi try to put the code into

Posted by Ivo.Radulovski on February 17, 2010 at 9:32pm

Hi try to put the code into the specific views tpl file if you need this only inside this view you can declare the js file here too. If you need more details just ask :)

-----

Drupal Development by Trio Interactive

Another way to do it is to

Posted by Garrett Albright on March 12, 2010 at 4:27am

Another way to do it is to create a new JavaScript file and add it to your theme the same way you did with the Masonry script. This section of the Drupal development guide should be of interest.

Javascript

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /