Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:25:56+00:00 2026-06-08T12:25:56+00:00

I have a parent div which in responsive width and fixed height with some

  • 0

I have a parent div which in responsive width and fixed height with some images inside it. On runtime I need a Jquery function to calculate the width and height of the div and apply the width (px) and height (px) parameters to image. i.e my code right now is

<div id="slider-wrapper" class="someclass">
    <img src="/image1.jpg" alt="" />
    <img src="/image2.jpg" alt="" />
    <img src="/image3.jpg" alt="" />
</div>

the generated code which I need would be

  <div id="slider-wrapper" class="someclass">
    <img src="/image1.jpg" height="300px" width="total-div-width(px)" alt="" />
    <img src="/image2.jpg" height="300px" width="total-div-width(px)" alt="" />
    <img src="/image3.jpg" height="300px" width="total-div-width(px)" alt="" />
</div>

Thank you in anticipation

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:25:57+00:00Added an answer on June 8, 2026 at 12:25 pm

    Using jQuery you can use .height(), .innerHeight() or .outerHeight().

    The differences are:

    • height() returns just the height of the element, no borders, no margins and no padding
    • innerHeight() returns the element height and the padding
    • outerHeight() returns the element height, the padding and borders
    • outerHeight(true) returns the element height, the padding, borders and margins

    I have more details including output examples using jsFiddle in this post here.

    For width you can use width(), innerWidth() or outerWidth().
    The same logic applies as with height.

    All values are in pixels.

    To get the height/width you can use it similar to this:

    // The below is an example, you need to add your element references as required.
    
    // Use height(), innerHeight() or outerHeight() as needed.
    var newHeight = $("#slider-wrapper").height();
    
    // Use width(), innerWidth() or outerWidth() as needed.
    var newWidth = $("#slider-wrapper").width();
    

    To set the height/width you can use it similar to:

    // The below is an example, you need to add your element references as required.
    var newHeight = $("#slider-wrapper img").height(newHeight);
    var newWidth = $("#slider-wrapper img").width(newWidth);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container div .parent with a fixed width 500px which contains a
If you have a parent div that wraps a fixed height div and a
Hi I have a simple sidebar inside a div which has height:100% and I
I have a parent div gal1 , inside which there can be further divs
I have a parent div id=A which has a width of 100%. I want
I have a google map inside of a div which gets changed, its parent
I have a parent div which is resizable (width only) - within this div
I have to create a widget for the div which is inside the jquery-tmpl
I have one parent DIV inside parent DIV i have two DIV one in
I have a function that prepends a li tag to a parent div just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.