You are here

function jscrollpane_add in JScrollPane 5

Add function.

1 call to jscrollpane_add()
jscrollpane_help in ./jscrollpane.module
Implementation of hook_help().

File

./jscrollpane.module, line 14
JavaScript based scrollable containers. http://kelvinluck.com/assets/jquery/jScrollPane

Code

function jscrollpane_add($selector = NULL, $options = array()) {
  static $included = FALSE;
  static $added = array();
  $path = drupal_get_path('module', 'jscrollpane');

  // Include jScrollPane.
  if ($included == FALSE) {
    drupal_add_js($path . '/jscrollpane.js');
    drupal_add_css($path . '/jscrollpane.css');
    $included = TRUE;
  }

  // Include Mouse Wheel if it's available.
  if (module_exists('mousewheel')) {
    mousewheel_add();
  }

  // Add the settings if they exist.
  if (isset($selector) && !isset($added[$selector])) {
    $added[$selector] = $options;
    drupal_add_js($path . '/jscrollpane-drupal.js');
    drupal_add_js(array(
      'jscrollpane' => array(
        $selector => $options,
      ),
    ), 'setting');
  }
}