Linking/unlinking jquery object to an element

前端 未结 3 1214
别跟我提以往
别跟我提以往 2021-01-06 01:52

I\'m using a jquery flowplayer tools plugin http://flowplayer.org/tools/tooltip.html

1)I want a tooltip to be created when user clicks on an element.

2)When

3条回答
  •  攒了一身酷
    2021-01-06 02:21

    The FlowPlayer Tooltip has an API that is returned on EVERY call to tooltip.

    You can then call hide on the API object.

    Here's what your code should look like:

        var old_id, API;
    
    //first time - create tooltip
        function my_create(id){
            API = $("#"+id).tooltip({ 
                effect: "slide", 
                tip: '.tooltip', 
                position: 'bottom center'
            });     
        }
    
     //next times - move tooltip to other element
        function my_unlink(id){
            API.unbind("mouseover"); 
            //todo
        }
    
        function my_link(id){
            my_create( id );
        }
    
    
        //THE MAIN FUNCTION
    
        function do_tip(new_id){
            if(old_id){
                my_unlink(old_id);
                my_link(new_id);
                alert(new_id);
            }
            else
                my_create(new_id);
    
            old_id=new_id;
         //new_id.focus();
     } 
    

提交回复
热议问题