Guest User

Untitled

a guest
Jan 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. .sticky {
  2. position: fixed;
  3. top: 0;
  4. align:center;
  5. width: 100%;
  6. background-color:#fff;
  7. }
  8. <div ID="zmyHeader" class="sticky" >
  9. ...
  10. <div id="headerResultTblFixedDiv">
  11. <table id="headerResultTblFixed" >
  12. <thead>
  13. <tr>
  14. <th>Col1Head</th>
  15. <th>Col2Head</th>
  16. </tr>
  17. </thead>
  18. </table>
  19. </div>
  20. </div>
  21. <div id="divResults" style="padding:0px;width:100%"> <!---div resultados-->
  22. <table id="resultsTable" width="967" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="white" >
  23. </tr>
  24. <td></td>
  25. </tr>
  26. </table>
  27. </div>
  28.  
  29. //IE 9 compatible
  30. var header = document.getElementById("zmyHeader");
  31. var divResults = document.getElementById("divResults");
  32.  
  33. var h = header.getBoundingClientRect().bottom - header.getBoundingClientRect().top;
  34.  
  35. var divheadertbl = document.getElementById("headerResultTblFixedDiv");
  36. if (divheadertbl) {
  37. var hdivheadertbl =divheadertbl.getBoundingClientRect().bottom - divheadertbl.getBoundingClientRect().top;
  38. divResults.style.paddingTop=(h-hdivheadertbl-5)+"px";
  39. }
  40. window.onscroll = function() {myFunction()};
  41.  
  42. function myFunction() {
  43. var Y = document.body.scrollLeft ;
  44. var j = Y;
  45. var supportPageOffset = window.pageXOffset !== undefined;
  46. var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
  47.  
  48. var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
  49. document.getElementById("zmyHeader").style.marginLeft=-x+"px";
  50. }
Add Comment
Please, Sign In to add comment