If you just want the function and don’t want to read the rubbish of why I used it then see below my good chum…
Use Case I have recently been working on a template built on Drupal, which allows the user to select their own colours using the color module.
One feature within the design is to have certain elements that would have a background/border colour that contrasts the background colour select by the user. »
You can programmatically add extra classes to the body tag via the themes template.php.
function themename_preprocess_html(&$variables) { // Add a extra class to the body element $variables['classes_array'][] = 'body__bg-color'; } »
I had a recent project where the page title has a background image and said image was to fade as the user started scrolling down the page.
The JQuery code below is who I archive it but you can go my JSfiddle to see it in action:
Fiddle me this
// Fade out the page title image as user scrolls var fadeStart = 0; // 0 scroll or less will equiv to 1 opacity var fadeUntil = 300; // 300px scroll or more will equiv to 0 opacity var fading = $('. »