I want to size my webpart height after ContentRow is resized but how ?

If I add my code to last of the webpart page for javascript like this,

    var h = (document.getElementById("contentRow").clientHeight);
    console.log(h); // output is 7
    var elems = document.getElementsByClassName('my-webpart');
    for (var i = 0; i < elems.length; i++) {
        elems[i].style.height = h + 'px';

I don't want to use window.load or jquery document ready as they take too much time to resize my webpart. I want my webpart to me contentRow height size as soon as possible.


Where can I find code where SharePoint team is setting height on contentRow on page load or on page resize?

Because contentRow inherits from s4-workspace, lets find out where its height is set and what happens on window resize

  • you tell me please which file of sharepoint resizes components, sp.runtime ? or whatever i will then see to wait till that executed Jun 22, 2015 at 7:08
  • is it related to SPAnimationUtility.BasicAnimator.QuickResize ? Jun 22, 2015 at 7:50

1 Answer 1


Not able to find what i wanted but found a substitute,

document.getElementById('my-webpart').style.height = (document.documentElement.clientHeight - 80) + 'px';

Yes i changed class to id to shorten code but main thing is this,

(document.documentElement.clientHeight - 80) + 'px';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.