Advertisement
Guest User

Untitled

a guest
May 21st, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function addAccountLeftAreaResizeHandler() {
  2.  
  3. let leftAreaTab = $('#account-form #left-area .left-area-tab:visible');
  4.  
  5. const initialDivHeight = window.innerHeight - window.innerHeight / 3.8;
  6.  
  7. if ($(document).scrollTop() === 0) {
  8.  
  9. leftAreaTab.height(window.innerHeight - window.innerHeight / 3.8);
  10.  
  11. } else {
  12.  
  13. leftAreaTab.height(window.innerHeight - window.innerHeight / 13 - 40);
  14.  
  15. }
  16.  
  17. window.addEventListener('scroll', function () {
  18.  
  19. let leftAreaOffsetTop = $('#account-form #left-area').offset().top;
  20.  
  21. let scrollTop = $(document).scrollTop(),
  22.  
  23. div = $('#account-form #left-area .left-area-tab:visible'),
  24.  
  25. divHeight = div.height();
  26.  
  27. // divInnerHeight = div.children().first()[0].clientHeight;
  28.  
  29. if (scrollTop < leftAreaOffsetTop) {
  30.  
  31. div.animate({
  32.  
  33. height: `${initialDivHeight + scrollTop + window.innerHeight / 110}px`
  34.  
  35. }, 1);
  36.  
  37. }
  38.  
  39. else if (divHeight >= window.innerHeight || (divHeight + scrollTop) >= window.innerHeight) {
  40.  
  41. div.animate({
  42.  
  43. height: `${window.innerHeight - window.innerHeight / 13 - 40 }px`
  44.  
  45. }, 1);
  46.  
  47. }
  48.  
  49. })
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement