This is driving me crazy, someone helps coz. I do not think where the problem is.
& lt; Div id = "parent" & gt; & Lt; Div id = "child" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Script & gt; Height (300) $ ('# child') height ($ ('# child'). Parent (). Height () - 10); // EDITTED LINE & lt; / Script & gt; The argument above is what I need to do. I check the html tag of "#parent", it says style = "height: 300px;" However, the child's value should be -10: (290), I have checked in the Dome, the value is correct I have tried the CSS ('height'), but there is no luck. Has anyone experienced such a problem? If so, then what is the solution :) I was thrown out of the missile pls
Sorry, this "parent (height). Height") Check the script again where the problem stands (sorry again) From)
.height () with 'px' it will receive Occasionally you have to remove 'PX', otherwise you are doing '300px' - 10 . You can do this:
var height = parseInt ($ ('# el'). Height (), 10); By this way, your code should be replaced with: <. Code> $ ('# child') height ($ ('# child') parent () height () - 10 ..); From
to:
$ ('# child') height (parseInt ($ ('# child'). Parent (). Height () , 10) -10); Or even better, add caching to your code to make it faster! (You do not have to refresh #child.)
var $ child = $ ('# child'); $ Child.height (parseInt ($ child.parent () height (), 10) -10.); You have also forgotten a semicolon on your first code line, although this is not my relationship.
Comments
Post a Comment