开发者

Changing DIV dimension with jQuery

I have the following div in my markup

<div id="sectionC开发者_如何学运维ontent" style="position: absolute; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; z-index: 1; top: 56px; bottom: 6px; left: 8px; right: 8px; width: 722px; height: 624px; visibility: visible; display: block;">
    <div id="actionArea" style="text-align: left; margin-bottom: 2px;">
        <button id="addNote"><span class="ui-button-text">Aggiungi Nota</span></button>
    </div>
    <!-- Contains all the notes and limits their movement -->
    <div style="margin: 0 auto; position:relative; width:100%; height: 100%; z-index: 10;">
    </div>
</div>

The outer DIV, "sectionContent", have its size automatically set at runtime by a jquery plugin that provide to its layout on the page. Inside this, I have the first DIV with a button ("actionArea") and the div with id="notesDesktop".

I would like to setup a size for the "notesDesktop" DIV that is

  • Width equal to the "sectionContent" DIV
  • Height equals to the "sectionContent" DIV minus the height of the "actionArea" DIV

How can I do this with jQuery?

thanks a lot for helping


This should do the trick:

$("#notesDesktop").width($("#sectionContent").width());
$("#notesDesktop").height($("#sectionContent").height() - $("#actionArea").height());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜