Project

General

Profile

Download (569 Bytes) Statistics
| Branch: | Tag: | Revision:
1
Your theme can add JavaScript files in two ways:
2

    
3
1. To add a JavaScript file to all pages on your website, edit your sub-theme's
4
   .info file and add a line like this one:
5

    
6
     scripts[] = js/my-jquery-script.js
7

    
8
2. To add a JavaScript file depending on a certain condition, you can add it
9
   using some PHP code in a preprocess function:
10

    
11
     drupal_add_js(drupal_get_path('theme', 'THEME_NAME') . '/js/my-jquery-script.js', array('group' => JS_THEME));
12

    
13
   For the full documentation of drupal_add_js(), see:
14
     http://api.drupal.org/api/function/drupal_add_js
(1-1/4)