| 742 | |
| 743 | |
| 744 | var elmnt1 = document.querySelector(".widget-liquid-right"); |
| 745 | var elmnt2 = document.querySelector(".widget-liquid-left"); |
| 746 | |
| 747 | var isInViewport = function (elmnt1) { |
| 748 | var bounding = elmnt1.getBoundingClientRect(); |
| 749 | return ( |
| 750 | bounding.top >= 0 && |
| 751 | bounding.left >= 0 && |
| 752 | bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && |
| 753 | bounding.right <= (window.innerWidth || document.documentElement.clientWidth) |
| 754 | ); |
| 755 | }; |
| 756 | |
| 757 | if (isInViewport(elmnt1)) { |
| 758 | elmnt1.style.position = "sticky"; |
| 759 | elmnt1.style.position = "-webkit-sticky"; |
| 760 | elmnt1.style.top = "42px"; |
| 761 | } |
| 762 | |
| 763 | |
| 764 | |
| 765 | window.onscroll = function scrollBottom(){ |
| 766 | if(elmnt1.getBoundingClientRect().bottom <= window.innerHeight) { |
| 767 | //// |
| 768 | } |
| 769 | |
| 770 | if(elmnt2.getBoundingClientRect().bottom <= window.innerHeight) { |
| 771 | //// |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | |