0

At the moment, I'm working on a website that requires an on-mouse over effect where the things that are going to be displayed is an image. I figure that the best way to go about this is by using jQuery.

Being a beginner at Drupal, I've noticed that all of the content in this website is generated from database calls. I was wondering if there was a module or a way to see how these calls are made so that I may be insert the correct code at the right place.

1 Answer 1

2

If you are customising a theme, I would add a custom jquery script you have written. In your themes template.php you can then simply call the .js file from within the theme folder.

For example you could add this to your template.php file:

drupal_add_js(drupal_get_path('theme', 'YOUR_THEME_NAME') . '/js/jquery.custom.js');

in the jquery.custom.js file you could have something like this:

(function($) {

 $(document).ready(function() {

  // hover effect
  $(".hover_effect").hover(function() { 
    //add effects here 
  }

 }); 

}(jQuery));
3
  • Does this mean that in addition to what's being called at the moment, I will have to create a custom jquery script to enable this?
    – Hectron
    Commented Nov 17, 2011 at 22:07
  • Well, you'd have to write the effect you'd want i guess, or customise an existing script. You'd still have to include it though. If you are going to add other effects, having your own seperate .js file makes sense. You could also instead of calling it all the time create a template file for that content type and include it there..
    – tecjam
    Commented Nov 17, 2011 at 22:13
  • This makes a lot of sense! Rather than just trying and pin-point the time of execution (which is taking me forever to figure out), develop something that is called whenever that object is instantiated. Thanks for the guidance, tecjam!
    – Hectron
    Commented Nov 17, 2011 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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