0

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,

<script>
    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';
    }
</script>

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.

EDIT

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

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

1 Answer 1

0

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.