3

I try use jQuery UI Tooltip Widget but i find some problem for me. If the tooltip is open, it removes title attribute on element over which it opened. How i can fix this? I try something like this:

<div class="spbin" title="NAME"><div class="ptmd aud" title="LINK"></div></div>

Script:

$('[title]').tooltip({
open:function(){var te=$('.ui-tooltip-content').html();
$(this).attr('title',te);}},
{show:{effect:'slideDown',delay:250}},
{hide:{effect:'explode',delay:250}},
{track:true});

But it not halp's me (

7
  • Why do you want to do this? I expect it does this to prevent the browser from displaying the title while the tooltip is displaying. Commented Dec 25, 2012 at 5:07
  • These attributes are used to another script. This example work well for one div & title element but not work if its more then one. Commented Dec 25, 2012 at 5:12
  • 3
    You shouldn't use title attributes for your own purposes. Put the information in a data-XXX attribute instead. Commented Dec 25, 2012 at 5:15
  • You are right, it does this to prevent the browser from displaying the title while the tooltip is displaying Commented Dec 25, 2012 at 5:16
  • Ok! I will try to do as you suggest Commented Dec 25, 2012 at 5:18

1 Answer 1

2

I did as advised Barmar. It worked. No longer need to return the value of the attribute title. I used the following code:

<div class="spbin" data-n="NAME">
     <div class="ptmd aud" data-l="LINK"></div>
</div>
<div class="tlv"></div>

Script:

$('[title]').tooltip(
    {show:{effect:'slideDown',delay:250}},
    {hide:{effect:'explode',delay:250}},
    {track:true}
);

$('.spbin').each(function(){
    $('.tlv',this).text(this.dataset.n);
    $(this).attr('title',this.dataset.n);
    $(this).hide();
    $(this).delay(du*2).fadeIn(du);
});

Thank you again Barmar!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.