Hi I have a web page with a fair bit of javascript on it, which is running perfectly well. I have a small panel showing my Latest Tweets from twitter.com My problem is that all the other javascript on the page it waiting for the twitter badge to go and get all the info it needs from twitters server before they render. This creates a 3-4 second gap before everything all the js is loaded. Is there anyway around开发者_StackOverflow中文版 this?
The javascript I'm using to pull info from twitter is
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/usernamehere.json?callback=twitterCallback2&count=3"></script>
If you use the default widget, there is a newer version that is nicer on your page load. Get it at http://twitter.com/about/resources/widgets/widget_profile
If you want to load JSON data yourself, get jQuery (http://jquery.com) and use $(document).ready() to start loading when the rest of the page has (almost) finished rendering.
Put the script at the bottom of the page.
Or load the script dynamically after the document is ready.
Or use HTML async script
<script type="text/javascript" src="blabla" async="async"></script>
精彩评论