-1

I have a views table containing a number of columns, one contains a small icon. I would like to have a tool tip open (containing the usual share widgets: twitter & facebook) when the image is clicked.

Could anyone suggest a way to achieve this?

0

There are a lots of modules providing tooltip functionality.

If you are familar with php coding:
1. Install Views PHP (https://drupal.org/project/views_php)
2. Install BeatuyTips (https://drupal.org/project/beautytips)
3. Create a PHP-field in your view and add the following code (Best is to include in your own module)


function render_socials($data = NULL){

  //if the links and icons are displayed inside the view, you can use $data

  $output .= l(theme('image', array('path' => 'PATH_TO_SOCIAL_ICON')), 'LINK_TO_SOCIAL_PROFILE', array('attributes' => array('class' => array('a.row-' . $data->nid . '-socials-popup')), 'html' => TRUE));
  $output .= l(theme('image', array('path' => 'PATH_TO_SECOND_SOCIAL_ICON')), 'LINK_TO_SOCIAL_PROFILE', array('attributes' => array('class' => array('a.row-' . $data->nid . '-socials-popup')), 'html' => TRUE));
  $output .= l(theme('image', array('path' => 'PATH_TO_THIRD_SOCIAL_ICON')), 'LINK_TO_SOCIAL_PROFILE', array('attributes' => array('class' => array('a.row-' . $data->nid . '-socials-popup')), 'html' => TRUE));
  $output .= l(theme('image', array('path' => 'PATH_TO_ANYOTHER_SOCIAL_ICON')), 'LINK_TO_SOCIAL_PROFILE', array('attributes' => array('class' => array('a.row-' . $data->nid . '-socials-popup')), 'html' => TRUE));
 }


$options['socials_' . $data->nid] = array(
         'cssSelect' => 'a.row-' . $data->nid . '-socials-popup',
         'text' => _render_socials($data),
         'trigger' => array(0 => 'mouseover', 1 => 'click'),
         'width' => 350,
       );
 print beautytips_add_beautytips($options);
1
  • Thank you for such a detailed answer. I will use your answer to get this working and report back. – Taylor Taff Nov 2 '13 at 10:06

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.