Need to resize a div by subtracting the height of another div using jquery.

Posted on 2011-10-05
Last Modified: 2012-05-12
Need to resize a div by subtracting the height of another div using jquery.

.main-wrapper is the body content
.slide is a column
.customize-opt is a div within the main-wrapper class

<div class="main-wrapper">
      <div class="customize-opt">
      <div class="slider">

resizeCol: function(){
      var $this = $(this),
      $slide = $('.slider'),
      $mainWrapper = $('.main-wrapper'),
      $customizeOpt = $('.customize-opt');
       $slide.css({'height': ($mainWrapper.height - $customizeOpt.height) + 'px'});
Question by:yando18
    1 Comment
    LVL 10

    Accepted Solution

    .height is a function so it should be .height()

    $slide.css({'height': ($mainWrapper.height() - $customizeOpt.height()) + 'px'});

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now