Solved

so why jquery animate function does not working?

Posted on 2010-11-20
4
861 Views
Last Modified: 2012-05-10
hi,

I have 2 divs, first one is 550px and the second one is 289px, the second one is inside the first one, I wanna animate the height of the first one to 289px, but that doesnt work!

so why jquery animate function does not working?

here is my code

                                        var inner_content_product = $("#inner_content_product").height();
                                        $("#products_main_contents").animate({ height: inner_content_product + "px" }, 1000);
0
Comment
Question by:njgroup
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:Codebot
Codebot earned 150 total points
ID: 34179566
Try this one

 var inner_content_product = $("#inner_content_product").height() + "px";
 $("#products_main_contents").animate({"height": inner_content_product }, {duration: 1000});

or try to set the misbehaving div to overflow:hidden;
0
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 350 total points
ID: 34179573
you jQuery code seem to be working fine. See http://jsfiddle.net/sudaraka/mR8YJ/
If it doesn't work in you script, the problem must be with HTML or CSS
0
 

Author Closing Comment

by:njgroup
ID: 34180137
sudaraka, you are correct, there was a problem in css

Codebot, thanks for response and support
0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 34180190
Glad to help. Thanks for the points.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

759 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

20 Experts available now in Live!

Get 1:1 Help Now