Compliance with the div-axle screen conditions



  • We need a condition in the crypt when the bottom of the block reaches the screen.

    I can't understand what a mistake is.

    window.onload = function(){
      var point_wrap = document.getElementById('point_wrap');
      var w_height = document.documentElement.clientHeight;
      var point_wrapSourceBottom = point_wrap.getBoundingClientRect().bottom + window.pageYOffset - w_height;
    

    window.onscroll = function() {

    if(window.pageYOffset > point_wrapSourceBottom) {
        условие, которое нужно выполнить
    }
    

    };
    };

    If you need a specific HTML code, I'll add it. But for now, I'll just tell you what the block is. #point_wrap It's not on the top of the screen and has a zero height. If substitute w_height the numerical value of the browser window height (621 I have), the code works properly.

    And the micro question is confusing. Why the Chrome doesn't show the variable point_wrapSourceBottom In f12, even when the violin works?



  • The question was decided to be replaced document.documentElement.clientHeightdocument.body.clientHeight I don't really know how crossbow it is.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2