开发者

Changing DIV dimension with jQuery

开发者 https://www.devze.com 2023-01-16 03:29 出处:网络
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;

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

精彩评论

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

关注公众号