how to set dynamically height to element?

后端 未结 4 2273
眼角桃花
眼角桃花 2021-02-19 03:18

I am trying to set dynamically height to element in my demo .I will tell you issue I am taking static or constant value of height in my demo .I take 250px const

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 03:56

    set dynamically height with header footer to element? HTML

    JS

    app.directive('winHeight', function ($window) {
        return{
            link: function (scope, element, attrs) {
                angular.element(window).resize(function () {
                    scope.winHeight();
                });
                setTimeout(function () {
                    scope.winHeight();
                }, 150);
                scope.winHeight = function () {
                    element.css('min-height', angular.element(window).height() - 
                    (angular.element('#header').height() + 
                     angular.element('#footer').height()));
                }
            }
        }
    })
    

提交回复
热议问题