Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Yeap, have been trying to grasp how to use this modules plug-ins, and especially Tooltip, by reading issues posted under this module, but no, I think it's not quite clear on how to implement it in a nodes content. Can some one please try to explain how to do this?
Thanks in advance.
Comments
Comment #1
jaxpax CreditAttribution: jaxpax commentedNo one?
Comment #2
heavy_engineer CreditAttribution: heavy_engineer commentedAdd this to the bottom of your template.php in your theme dir
Or create a module and load it from that.
Comment #3
jaxpax CreditAttribution: jaxpax commentedthanks a bunch but nothing really happens when hovering the image...
1. I added
<?php jquery_plugin_add('tooltip');?>
in the bottom of node.tpl.php2. I uploaded tools.tooltip-1.1.3.js and tools.tooltip-1.1.3.css in jqueri_plugin folder
3. The tooltip plugin putting jquery.tooltip.min.js is in jqueri_plugin folder.
4. I added the following lines in node content area:
The tooltip script is invoked according to the source in the browser:
<script type="text/javascript" src="/sites/all/modules/jquery_plugin/jquery.tooltip.min.js?S"></script>
Comment #4
ludo1960 CreditAttribution: ludo1960 commentedI think you must put the code in template.tpl.php and not node.tpl.php as this wont work!
Comment #5
jaxpax CreditAttribution: jaxpax commentedThanks for the reply.
I put the code in the template.php file (couldn't find template.tpl.php in my themes folder) but still nothing happens. :(
What about the other steps I explained that I did, are they correct?
I know I'm a little bit stubborn about knowing how to fix this, because It's very important to me. It's quite frustrating having to stand beside and watch all the great things one can do with jQuery and not being able to get it to work, so I hope you guys bare with me a little bit longer. =)
Comment #6
jghyde CreditAttribution: jghyde commentedThis module was built to be added as a dependency for other modules by module developers. Theme developers can still use it, but you have to make the jquery_add_plugin() call before the page.tpl.php loads. In this case, the best way is to call the jquery_plugin_add($plugin) in the node.tpl.php template. Then, all features of the particular jquery tools module are available on the page with that particular node.tpl.php.
If you'd like more control, you can ignore this plugin in lieu of adding the call for the plugin into the *.info of the theme, and store the *js modules in the sites/all/themes/[theme-name] directory.
Comment #7
jaimealsilva CreditAttribution: jaimealsilva commentedFor a theme put the function call in the template.php file, outside any function.
Comment #8
scottsawyerI should be understanding this, but alas, I am still struggling. So far, I have in my template.php:
and in the header of my page.tpl.php
So far, no results. What I am looking for is a tooltip when the mouse hovers over an anchor in an unordered list with class="social-links".
Thank you in advance for any help :)
Comment #9
scottsawyerOk, found the first error: should be jquery_plugin_add('tooltip'); not, jquery_add_plugin('tooltip'); what that syntax!
So now I see I am loading the tooltip plugin, but it is still not firing with my document ready function.
I have tried using the javascript inline and in the header in my page.tpl.php.
Any help would be great.
Comment #10
mogop CreditAttribution: mogop commentedI get error
when I put
jquery_plugin_add('tooltip');
in my template.tpl.php (using ZEN theme) and also I addjquery.tools.min.js
in my .info fileComment #11
novakov CreditAttribution: novakov commentedcould not get to work it too
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '&' or T_VARIABLE in ...node.tpl.php / template.php
Comment #12
trevorleenc CreditAttribution: trevorleenc commentedhaving the same issue as scottsawyer
here is the code in my template.php
this "should" kick off the tooltip for anything on my page that has a title...I also have the css code in my stylesheet, but nothing seems to be appearing.
Comment #13
jghyde CreditAttribution: jghyde commentedtrevor--
I disagree with the concept of placing this function outside of, say, a preprocess function. It gets called like 400 times when you do that--very inefficient! Here is a suggestion of how to use it more Drupaly:
Drupal 6 Example
Drupal 7 requires a different way to call the jQuery selector. The D7 jQuery protects the '$' function character so other javascript libraries can use it.
Drupal 7 example:
Note the change to the jQuery inline script to enclose your regular jQuery function in the '$' declaration:
Comment #14
AndrejT CreditAttribution: AndrejT commentedI wish to use a jQuery Countdown Script in maintenance mode page (Drupal 7).
How can I add this script to that page?
Thanks in advance.
Comment #15
ZPRaven CreditAttribution: ZPRaven commentedI used "Drupal 7 example" (from jghyde) - no results. Only blank page. What's the problem?
Comment #16
woop_light CreditAttribution: woop_light commentedThis seems like a wonderful module. Any chance someone might be able to spell out (in painful detail) how to configure the simplest jquery function -- such as putting a tooltip on the site logo? It would help a lot of someone described exactly where to put the code. I think if some of us could just see how the pieces fit together we would be able to run with it!This helped me see how everyone can be configured: http://drupal.org/project/jq4dat
woop
Comment #17
bluestarstudios CreditAttribution: bluestarstudios commentedCan somebody please help out here? I followed the steps. I can easily get this to work in Drupal 6, but no success in Drupal 7. Here's my template.php file:
In my nodes I have a field that has a class="locked". Additionally I have a block that has my tooltip content
<div id="tooltip">My Tooltip Content</div>
Finally I have this in my css
The trigger seems to initialize something, however it totally doesn't get the tooltip to show. Instead it renders the remaining JS on the page inoperable. Do I need to use JQuery Update to use Tooltip? Or do i need to download any additional libraries?
THANKS!
Comment #18
gagarine CreditAttribution: gagarine commented#13 is wrong for D7 and you will end up with a blank page. The JS is also not good, you should not use document.ready anymore for D7 see http://drupal.org/node/756722.
D7 example:
drupal_add_library() is a Drupal core function the first param is alway going to be jquery_plugin and the seconde the name of the plugin you want to load.
No need to download anything more than this module, plugins are packaged inside.
This is not right. If you call the function inside your template.php outside any function your code is going to be called only one single time. But if you call it inside a preprocess function he can be called more than one time (like preprocess_node).
Comment #19
loopy1492 CreditAttribution: loopy1492 commentedI am losing my bananas.
I have installed this module.
I have added the following to my theme__preprocess_html function:
drupal_add_library('jquery_plugin', 'tooltip');
I have installed the jQuery Update module.
I have this in a node and BOTH of the alerts work, but not the tooltip. What am I doing wrong?
Comment #20
loopy1492 CreditAttribution: loopy1492 commentedGot it to work. I had to downgrade to jQuery 1.7. Go figure.