Reputation: 4177
We can use $('selector')[0].scrollHeight
to get the height of a scrollable div using jquery
I'm not getting the height of div using the above property As I've used custom scrollbar (mcustomscrollbar) here.
Is there any way to get the height of a scrollable div in case of mcustomscrollbar ?
Here is my fiddle to get height of a scrollable div
Please advise me..
Thanks in advance
Upvotes: 0
Views: 499
Reputation: 4177
I didn't find any trick to get the height of a scrollable div which has a custom scrollabar
finally i come up with this solution
Just getting the height by doing the summation of the selector childrens
just like below
$(function () {
$(".content").mCustomScrollbar({
setHeight: 300
});
height = calcualte_height();
alert($('.content').prop('scrollHeight'));
alert(height)
});
function calcualte_height() {
height = 0;
$('.content').children().each(function() {
height += $(this).prop('scrollHeight');
})
return height;
}
Updated fiddle
Upvotes: 1