Guest User

Untitled

a guest
Oct 19th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $('.msg_id').live("mouseover", function() {
  2.     $(this).css('cursor', 'pointer');
  3.     tid = $(this).attr('id');
  4.     idx = $(this).attr('name');
  5.     mDiv = $(this);
  6.     $.post("log_msg.asp", $("#msgForm").serialize() + "&aktion=popup&msg_id="+tid+"&msg_id"+idx,
  7.         function(data) {       
  8.           $("#"+tid).html(data);    
  9.         }).success(function(){
  10.              console.log(mDiv);
  11.              popd = $('.popup-div', mDiv);
  12.              console.log(popd);
  13.              //$('#bub'+tid).css('display', 'block');  
  14.              popd.css('display', 'block'); 
  15.             });
  16.     });
  17.  
  18.  
  19. ------------------------------------------------------------------------------------------------
  20.  
  21. this inserts:
  22. <div id="bub4823401" class="bubbleInfo">
  23. <div class="trigger">&nbsp;</div>
  24. <div class="popup-div" style="display: block;">
  25. <table id="dpop" class="popup" style="opacity: 0; display: none;">
  26. <tbody>
  27. <tr> <!-- C U T  -></tr>
  28. </tbody>
  29. </table>
  30. </div>
  31. </div>
  32.  
  33. ------------------------------------------------------------------------------------------------
  34. which has a listener
  35.    $('.bubbleInfo').live("mouseover mouseout", function(event) {
  36.         var distance = -10;
  37.         var time = 250;
  38.         var hideDelay = 0;
  39.  
  40.         var hideDelayTimer = null;
  41.  
  42.         var beingShown = false;
  43.         var shown = false;
  44.         var trigger = $('.trigger', this);
  45.         var info = $('.popup', this).css('opacity', 0);
  46.                 var popd = $('.popup-div', this);
  47.         if ( event.type == "mouseover" ) {        
  48.             $([trigger.get(0), info.get(0)]).mouseover(function ()
  49.              {  
  50.                 //var poppos = this.position();  
  51.                 var pdpos = popd.position().top;
  52.                 var pdpos2 = popd.offset().top;
  53.                 //var bott =  $(document).height() - poppos.top;
  54.                             var p = $(window).height() - pdpos;
  55.                             var infoh = info.height();
  56.                          
  57.                             popd.css("top", pdpos);
  58.                             if(p < infoh)
  59.                             {
  60.                                 //popd.css("top", pdpos - infoh );
  61.                             }
  62.                              
  63.                 if (hideDelayTimer) clearTimeout(hideDelayTimer);
  64.                 if (beingShown || shown) {
  65.                     // don't trigger the animation again
  66.                     return;
  67.                 } else {
  68.                     // reset position of info box
  69.                     beingShown = true;         
  70.                     info.css({          
  71.                         display: 'block'                       
  72.                     }).animate({                      
  73.                        
  74.                         opacity: 1
  75.                     }, time, 'swing', function() {
  76.                         beingShown = false;
  77.                         shown = true;
  78.                     });
  79.                
  80.                 }
  81.            
  82.                 return false;  
  83.                     });
  84.       }
  85.         if ( event.type == "mouseout" ) {  
  86.         //.mouseout(function () {
  87.             if (hideDelayTimer) clearTimeout(hideDelayTimer);
  88.             hideDelayTimer = setTimeout(function () {
  89.                 hideDelayTimer = null;
  90.                 info.animate({
  91.                     //top: '=' + distance + 'px',
  92.                     opacity: 0
  93.                 }, time, 'swing', function () {
  94.                     shown = false;
  95.                     info.css('display', 'none');
  96.                    
  97.                 });
  98.  
  99.             }, hideDelay);
  100.  
  101.             return false;
  102.           }
  103.         });
Add Comment
Please, Sign In to add comment