The adaptive height of animate in jquery

Source: Internet
Author: User
Most CSS properties can be manipulated with the animate () method, but the value of its properties cannot be a string, and many people have encountered this problem. For example: Gets the height of an element when it is adaptive, but el.animate ({height: ' auto '}) has no effect. Today I also met this, took a little time to solve the problem, and then want to make an essay, by the way to share with you. (rookie one, first hair essays, do not like to spray as far as possible, Xi Hee)

Solution: Use CSS to get the current element to adapt to the high, and then can be used directly.

var h_header=header.css ("Height", "Auto"). Height ();

Header.animate ({height:h_header},500);

The adaptive height of animate in jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.