Lorenzo
Lorenzo

Reputation: 29427

Changing DIV dimension with jQuery

I have the following div in my markup

<div id="sectionContent" 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

How can I do this with jQuery?

thanks a lot for helping

Upvotes: 0

Views: 216

Answers (1)

Chris Laplante
Chris Laplante

Reputation: 29658

This should do the trick:

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

Upvotes: 1

Related Questions