Reputation:
I am trying to find out why jquery can't return the actual heigth of the jquery-mobile header, see this screenshot: http://i43.tinypic.com/21epavn.png, the header is 42px high, and jquery returns
>$('body').find('div[data-role=header]').css('height')
"40px"
What's wrong?
Upvotes: 1
Views: 358
Reputation: 15099
I'm guessing (could be wrong, but my first thought...) that the height of the element is 40px, and then it has a 1px margin/padding/border wrapped around it. Try specifying the following in your CSS:
div[data-role=header] {margin:0;border:0;padding:0}
and see if you still have this problem?
According to Rob W, there is a .outerHeight() function in jQuery which will include the padding in its calculation. Consider using that instead if you don't want to remove your padding.
Upvotes: 3