开发者

How can I get the width of a layoutUnit that doesn't include its scrollbar?

开发者 https://www.devze.com 2022-12-20 12:01 出处:网络
I\'m trying to make my layout update the width of another element, but I need to get at its width NOT including its scrollbar (if one is indeed present). getMainContentBounds() in this case seems to b

I'm trying to make my layout update the width of another element, but I need to get at its width NOT including its scrollbar (if one is indeed present). getMainContentBounds() in this case seems to be returning the entire width along with the scrollbar.

开发者_StackOverflow

I have also tried getSizes() with the same result.

myDataTable.on('postRenderEvent', function() {
    var bounds = YAHOO.specify.app.layout.getMainContentBounds();
    Dom.setStyle(YAHOO.util.Selector.query('div.yui-dt-hd', c.body), 'width', bounds.width+'px');
    Dom.setStyle(YAHOO.util.Selector.query('div.yui-dt-bd', c.body), 'width', bounds.width+'px');
});


Why don't you place your a marker "element" inside the scrollable.

<div style="width: 200px; overflow: auto;">
    <div id="the-div-width">
        Your content.
    </div>
</div>

Then just focus on getting the width on the-div-width's actual width...

0

精彩评论

暂无评论...
验证码 换一张
取 消