Table thead :display on tr:hover -


i want reproduce effect on website http://sires.crv4all.us/shop/us/catalog/holstein

when hover <tr> displays thead information above <tr> line cursor is.

i tried using jquery tooltip displays thead on top. want find out how make display tr line hovering.

here jsfiddle made producing effect (i'm kinda new js/jquery please feel free critique code, know pretty inefficient).

on page looks js driving it:

  var $div = $('<div class="floating-header" style="position:absolute;z-index:1;display:none"><table><thead></thead></table></div>');     $(document.body).prepend($div);      var $source = $('#animals thead');      // lock widths     $source.find('th').each(function(){       var $this = $(this);       $this.css({width: + $this.width() + 'px'});     })      // position floater     $div.find('thead').append($source.html());     var offset = $source.offset();     $div.css({       left: offset.left,                                                              top: offset.top     })      // strip off junk     $th = $div.find('th');     var thidx = 0;     var thlength = $th.length;             var cartenabled = false;      $th.each(function(){       var $this = $(this);       $this.html($this.find('a').text());       if (thidx<=2 || (cartenabled && thidx==(thlength-1))) $this.css({opacity:0});       thidx++;     });      // exclude first row (initial state on page load; updated facets.js)     $('#animals tbody tr:visible').first().addclass('no-header');      var header_height = $div.height();      // set-up events     $('#animals tbody tr').mouseover(function(){       var $row = $(this);        setmytimeout(function(){         if ($row.hasclass('no-header')) return;         $div.stop().css({           top: ($row.offset().top - header_height) + 'px',           left: $row.offset().left,          opacity: 0.5}).fadein(200);       },100);     });      $('#animals tbody tr').mouseout(function(){       setmytimeout(function(){         $div.fadeout(200);       },50);     });   }); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -