Tooltip Speed

Discussion in 'JavaScript' started by cancer10, Jul 15, 2009.

  1. #1
    Hi

    Please consider the attached zip file.

    Its a fully functional javascript tooltip script.

    When you run the index.html file in the zip achieve, and you hover on the text, it ill display a baloon tooltip.

    Is there anyway I can make that tooltip delay in showing?

    I mean it should be like that when I mouseover the text, aftr 2 seconds the popup should appear.


    Please tell me which line should I modify to make this happen?


    Many thanks
     

    Attached Files:

    cancer10, Jul 15, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    you have already added an option 'timeout' but it's not being referenced anywhere


    the main function that does the show is this.btOn();

    to implement a delay first of all you need the default:
    
    jQuery.bt.defaults = {
    ... something: somevalue, 
        timeout: 0
    }
    
    PHP:
    then find all lines that go:
    
        $(this).hover(
            function() {
              this.btOn();
            },
            function() {
              this.btOff();
            }
          );
    
    PHP:
    and modify the call to something like:

    this.timer = setTimeout(opts.timeout, this.btOn);

    add to btOff:

    clearTimeout(this.timer); // if queued to show but moused out, dont bother
    this.btOff();

    also, check if you don;t need to install hoverIntent plugin - look at this:
    i dont know jquery or this tooltip plugin (using canvas? please....) or whatnot but it should work. and check the hoverIntent, it may be just what you need.
     
    dimitar christoff, Jul 17, 2009 IP
  3. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi

    I cannot get this to work. can you pls modify it to me pls?


    Also, can we have a close button on the balloon, clicking on which would close the tooltip balloon?


    Many thanks
     
    cancer10, Jul 20, 2009 IP