Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to drupal 7 and I'm having issues getting the smooth div scroll to work. What I'm going for is this! I also need it to be on every page of the site.

I downloaded the Zip file which is actually for this! I figured I'll alter the js and css files later. I placed in both sites/all/libraries and sites/all/modules. I copied the jquery-ui-1.8.23.custom.min file to /modules folder.

I then pasted this code to my template.php :

function best_responsive_preprocess_page(&$vars) {

//  if we are at frontpage, add some jquery code to do the animation
   if ($vars['is_front']) {
       $vars['script'] = drupal_get_js();
       $vars['styles'] = drupal_get_css();

But that didn't do the trick.

What could be the issue here, or perhaps there is an another way to achieving this?

Many thanks.

share|improve this question
up vote 0 down vote accepted

is your function called ? put a drupal_set_message('hello'); in it to see.

remove these to lines, they're not needed

$vars['script'] = drupal_get_js();
$vars['styles'] = drupal_get_css();

then - you need to add some custom JS, where you tell which of your div should be modified:

drupal_add_js('jQuery(document).ready(function () { $("#logoParade").smoothDivScroll({ 
    autoScrollingMode: "always", 
    autoScrollingDirection: "endlessLoopRight", 
    autoScrollingStep: 1, 
    autoScrollingInterval: 25 

// Logo parade event handlers
$("#logoParade").bind("mouseover", function() {
}).bind("mouseout", function() {
}); });', 'inline')

is this div already setup ?

else - add it in page.tpl.php or whereever you like to ..

share|improve this answer
Where do I need to paste the custom js? – Laniakea Feb 20 '13 at 19:33
do that in your best_responsive_preprocess_page function – rémy Feb 21 '13 at 16:30
I'm getting errors when pasting the custom js after the best_responsive_preprocess_page function. Here is a link! to the code. – Laniakea Feb 23 '13 at 16:06
how does your HTML look like ? / what error's do you get ? – rémy Feb 24 '13 at 12:14
I'm getting the following error: "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Users\Martin\Sites\acquia-drupal\sites\all\themes\best_responsive\template.ph‌​p on line 96" I added the HTML code to the previous link. Do you need to see the full HTML before I edited the template.php file? – Laniakea Feb 24 '13 at 16:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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