How to add fancybox gallery to Drupal site

You should add this peace of js to your template for adding fancybox gallery to you site. We can add it inside file.info by adding string:

scripts[] = js/script.js

or we can simply add it inside any template we need. This code adds class zoom to special link on the node page, then we call fancybox gallery for any link with zoom class. To make navigation between our images we need to put rel attribute inside our link. We can do this with a help of theming. Here is a link http://html-and-cms.com/node/67

{syntaxhighlighter brush: css;fontsize: 100; first-line: 1; }<script type="text/javascript"> jQuery(document).ready(function() { jQuery('body.page-node .field-type-image div.field-item a').addClass("zoom"); jQuery('a.zoom').fancybox(); }); </script>{/syntaxhighlighter}
Rating: 
6 out of 10 based on 4 ratings.