Reputation: 10094
If I use (body).height();
to calculate a windows height, is there a way to calculate the height -100px.
Is there a way to do this as part of the (body).height();
query rather than calculating it later on ?
Upvotes: 0
Views: 1287
Reputation: 3754
The fastest way would be :
var H = $(body).height() - 100 + 'px';
console.log(H);
Upvotes: 0
Reputation: 5115
If you don't want to calculate it each time and deducting 100, you can define a custom function that will do it for you:
function bodyHeight() {
return $("body").height()-100;
}
And then just call bodyHeight()
instead of $("body").height()
.
Upvotes: 0