Advertisement
Kimeraweb

Tip

Jan 29th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.46 KB | None | 0 0
  1. $(function()
  2. {
  3.   var hideDelay = 500;  
  4.   var currentID;
  5.   var hideTimer = null;
  6.  
  7.   // One instance that's reused to show info for the current person
  8.   var container = $('<div id="personPopupContainer">'
  9.       + '<table width="" border="0" cellspacing="0" cellpadding="0" align="center" class="personPopupPopup">'
  10.       + '<tr>'
  11.       + '   <td> </td>'
  12.       + '   <td></td>'
  13.       + '   <td></td>'
  14.       + '</tr>'
  15.       + '<tr>'
  16.       + '   <td></td>'
  17.       + '   <td><div id="personPopupContent"></div></td>'
  18.       + '   <td></td>'
  19.       + '</tr>'
  20.       + '<tr>'
  21.       + '   <td></td>'
  22.       + '   <td></td>'
  23.       + '   <td></td>'
  24.       + '</tr>'
  25.       + '</table>'
  26.       + '</div>');
  27.  
  28.   $('body').append(container);
  29.  
  30.   $('.personPopupTrigger').live('mouseover', function()
  31.   {
  32.       // format of 'rel' tag: sname,url
  33.       var settings = $(this).attr('rel').split(',');
  34.       var sname = settings[0];
  35.       var url = settings[1];
  36.  
  37.       // If no sname in url rel tag, don't popup blank
  38.       if (sname == '')
  39.           return;
  40.          
  41.       if (hideTimer)
  42.           clearTimeout(hideTimer);
  43.  
  44.       var pos = $(this).offset();
  45.       var width = $(this).width();
  46.       container.css({
  47.           left: (120) + 'px',
  48.           top: pos.top - 5 + 'px'
  49.       });
  50.  
  51.       //$('#personPopupContent').html('<span style="color:#FFFFFF;">Esto seria el texto.</span>');
  52.  
  53.      /* $.ajax({
  54.           type: 'GET',
  55.           url: url,
  56.           data: 'sname=' + sname + '&url=' + url,
  57.           success: function(data)
  58.           {
  59.             var text = $(data).find('.personPopupResult').html();
  60.             $('#personPopupContent').html(text);
  61.           }
  62.       }); */
  63.       $('#personPopupContent').load( url , {sname : sname});
  64.      
  65.  
  66.       container.css('display', 'block');
  67.   });
  68.  
  69.   $('.personPopupTrigger').live('mouseout', function()
  70.   {
  71.       if (hideTimer)
  72.           clearTimeout(hideTimer);
  73.       hideTimer = setTimeout(function()
  74.       {
  75.           container.css('display', 'none');
  76.       }, hideDelay);
  77.   });
  78.  
  79.   // Allow mouse over of details without hiding details
  80.   $('#personPopupContainer').mouseover(function()
  81.   {
  82.       if (hideTimer)
  83.           clearTimeout(hideTimer);
  84.   });
  85.  
  86.   // Hide after mouseout
  87.   $('#personPopupContainer').mouseout(function()
  88.   {
  89.       if (hideTimer)
  90.           clearTimeout(hideTimer);
  91.       hideTimer = setTimeout(function()
  92.       {
  93.           container.css('display', 'none');
  94.       }, hideDelay);
  95.   });
  96. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement