1

I am attempting to make use of a jQuery script that will enable a "slider" or "slideshow" on my Drupal 7 front page. The instructions for the jQuery plugin (called FlexSlider) say to insert the following items into the header of the page where I want to use the plugin.

<!-- Place somewhere in the <head> of your document -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">`</script>
<script src="jquery.flexslider.js"></script>

The problem is I don't know where in my template file I place these directives. I am using a custom front page for Drupal so I have a template file named page--front.tpl.php. Do the directives go in there or some other location?

  • If you're not using Flexslider module, your slider will work on jQuery included in drupal core, but some flexslider plugins, like "animate colors" requires jQuery v 1.5.2 or higher. You can update your core jQuery with this modlule: drupal.org/project/jquery_update – Jack-PL May 4 '13 at 16:43
2

The best way to do this is to add the files inside your theme's info file. However you shouldn't need the jquery file, this is included in Drupal core.

scripts[] = scripts.js
stylesheets[all][] = style.css

Morea bout info files here: http://drupal.org/node/171205

1

You probably want to use the Drupal Flexslider module, no?

Alternatively you could add the files to your theme and your theme .info file, with

scripts[] = 'js/flexslider.js'
stylesheets[all][] = flexslider.css

path should be relative to the .info file, so if you say js/flexslider.js the flexslider.js file must be inside the js directory in your theme.

Alternatively with a module and drupal_add_js and drupal_add_css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.