[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2011-10-05
Medium Priority
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

JPJ78 earned 2000 total points
ID: 36918793
.height is a function so it should be .height()

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 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