0

I have the Jquery qtip() function and i need to get the id when mouseover a link. Can i'm using jquery .load() to get the page. Cant able to get using below code. Anyone know?

Below is my script

$(function () {
      $(".cabinlink").qtip({
content: $("#loadCabin").load("/mysite ." + $(this).attr('id')),

                 show: 'mouseover',
                 hide: 'mouseout',

                 style: {
                     width: 780
                 },
                 position: {
                     corner: {
                         target: 'LeftBottom',
                         tooltip: 'TopLeft'
                     }
                 }
             });
         });

.cabinlink is the mousehover link

<a id="1" href="javascript:void(0)" class="cabinlink" />
<a id="2" href="javascript:void(0)" class="cabinlink" />
<a id="3" href="javascript:void(0)" class="cabinlink" />

loadCabin is the div to open up the qtip box

<div id="loadCabin"></div>

Amended codes, able to work but need to mouse over two times. first mouseover no result. Anyone know?

 $(function () {
         $(".cabinlink").live('mouseover', function () {

             var id = $(this).attr('id');
             var url = "/Mysite ." + id;
             $(this).qtip({
                 overwrite: false,
                 content: $("#loadCabin").load(url),
                 show: { ready: true, when: false },
                 hide: 'mouseout',
                 style: {
                     width: 780
                 },
                 position: {
                     corner: {
                         target: 'LeftBottom',
                         tooltip: 'TopLeft'
                     }
                 }

             });
         });

     });
4

1 回答 1

0

尝试这个:

$(".cabinlink").qtip({
    onShow: function() {
        $("#loadCabin").load("/mysite." + $(this).attr('id'))
    },

     show: 'mouseover',
     hide: 'mouseout',

     style: {
         width: 780
     },
     position: {
         corner: {
             target: 'LeftBottom',
             tooltip: 'TopLeft'
         }
     }
 });

如果这不起作用,其他回调函数之一可能...请参阅http://craigsworks.com/projects/qtip/docs/api/#callbacks

于 2013-03-06T03:38:54.760 回答