I am displaying tweets on my website. However, since the tweet widget is always a different size, I want to get the height of the widget so that I can adjust the size of the modal it is displayed in accordingly.
console.log($('.autosized-media').height())
returns null
It probably depends on when you're trying to get at the height of the Twitter box. See fiddle: http://jsfiddle.net/DFYCS/
$(document).ready(function () {
console.log($('#twitter-widget-0').height());
$('#height-btn').on('click',function(){
console.log($('#twitter-widget-0').height());
});
});
If you're trying to get at the height of the Twitter widget when the page loads, it's not going to be available yet. But clicking the button after load will get you the correct value.
So you'll need to look at something like this: Twitter Embedded Timeline Callback. That modifies the existing Twitter widget script to run a callback script. That's how you can detect when the Twitter widget has loaded and do something to get the height then. That's probably going to be the only reliable way to do that.