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 6180189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:48:11+00:00 2026-05-24T00:48:11+00:00

I have encountered noumerous ways of expanding elements on webpages, for example divs with

  • 0

I have encountered noumerous ways of expanding elements on webpages, for example divs with javascript and jquery. I would like to know what is the best and easiest way of doing this when we look at performance and so on.

In my example i have got a new site that i am building and on the front page a news section. The news items should be in a specific height, say 250px and the width is that of the container (using 960 grid css).

I have got this layout.

<div class="grid_10 news">
   <article></article>
   <article></article>
   <article></article>
   <article></article>
</div>

The article contains ofc information, metadata and so on but also a “read more” link on the right side that should expand the article to its full height.

Right now, i have no specific height or css to the article (except display: block). So what would you guys use for technique and how would you do?

Cheers.

  • 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-05-24T00:48:12+00:00Added an answer on May 24, 2026 at 12:48 am

    You could set the height to auto, if you never know the new upcoming height.
    So if the article is the parent of your read more-button/-link you could do the following:

    $(".your_read_more_button").parent().css('height', 'auto');
    

    That’s not directly animatable though, so if you are looking for smooth transitions, you would either have to clone it and get the actually displayed height, then animate the original, or use slideUp() and slideDown() and change the height in between.

    If you know the height before AND after expanding then you can do the following css3 transitions:

    .news article
    {
       -moz-transition: height 1s ease-in-out;
       -webkit-transition: height 1s ease-in-out;
       -o-transition: height 1s ease-in-out;
       transition: height 1s ease-in-out;
    }
    
    .expanded
    {
       height: 250px;
    }
    

    or you simply use jQuery animate:

    $('article').stop(true,true).animate({height: 250px}, 400);
    

    That will only change from 1 height to the other, unlike .toggle(), which makes the element invisible for a short moment, which i personally find more likely to disturb the pages overall impression during its animation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a very strange problem in using jQuery load() . I used
I have encountered a very strange problem. The jquery slideshow in the below webpage
I would like to ask a help for the problem I encountered. My mysql
I have encountered many different ways to turn a Java program into a Windows
I have encountered the following dilemma several times and would be interested to hear
I have encountered a situation where it would be very useful to specify a
I have encountered the following problem which proved to me that I know far
I have encountered code like if (flagsDef) flagsTainted |= flagsUsed; please assist in knowing
I have encountered what appears to be a bug with the YAML parser. Take
I have encountered a problem with creating a thumbnail from an uploaded image file,

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.