offsetHeight / clientHeight / scrollHeight never change

前端 未结 2 791
花落未央
花落未央 2021-01-23 03:51

I\'m building a scrolling directive with Angular and see a strange behavior of element heights. They do not change on resize. I went down to the simplest plain JS, but the bug i

2条回答
  •  半阙折子戏
    2021-01-23 04:31

    you can plug this into your link function in your directive,

    angular.element($window).bind('resize', function () {
       rebuild();
    });
    

    make sure to inject $window into the directive function, and just call rebuild or another function inside. of course, you should also change the transcluded to the appropriate angularJS form.

提交回复
热议问题