Tooltip for ajax content

90 views
Skip to first unread message

Viper

unread,
Jul 15, 2013, 3:13:21 PM7/15/13
to joomla-de...@googlegroups.com
Can anybody tell how to implement it?

I try JHtml::_('behavior.tooltip'); on the page
which loaded into the div and w/o success.

Fedir

unread,
Jul 15, 2013, 5:11:02 PM7/15/13
to joomla-de...@googlegroups.com
of course, because JHtml::_('behavior.tooltip'); do not know that you works with AJAX

you need initialize the "tooltip" script each time when you refresh the content via AJAX,
but as Joomla have no simple way for it, you need to duplicate the code from  ('behavior.tooltip') in you AJAX code,
make the callback, something like:

function ajaxLoadedCallback(){
  $$('#my-block .hasTip').each(function(el) {
    var title = el.get('title');
    if (title) {
      var parts = title.split('::', 2);
      el.store('tip:title', parts[0]);
      el.store('tip:text', parts[1]);
     }
   });
   var JTooltips = new Tips($$('#my-block .hasTip'), $options);
}

hope it will helps ;)

Понеділок, 15 липня 2013 р. 22:13:21 UTC+3 користувач Viper написав:

Viper

unread,
Jul 15, 2013, 5:46:25 PM7/15/13
to joomla-de...@googlegroups.com
Thank you! It's works but with small fixes

window.addEvent('domready', function() {
    $$('.hasTip').each(function(el) {

        var title = el.get('title');
        if (title) {
            var parts = title.split('::', 2);
            el.store('tip:title', parts[0]);
            el.store('tip:text', parts[1]);
        }
    });
    var JTooltips = new Tips($$('.hasTip'), {});
});


And I replaced an 'options' object, I think what class uses default values.
Reply all
Reply to author
Forward
0 new messages