Maca
Maca

Reputation: 1689

How do I load Javascript within jQuery based tabs?

I have Jquery and CSS tab like this one and in the each tab I have facebook feed box, twitter widget, and my blog's ranking widget. BUT if I place these widgets within the tab area content, each widgets stops working. How do I get these widgets to load with in these jQuery tabs?

My tabs: http://www.sohtanaka.com/web-design/examples/tabs/

Upvotes: 0

Views: 332

Answers (1)

Mouhannad
Mouhannad

Reputation: 2209

Look at jQuery.getScript

$.getScript('js-url', function(){
    //the loading is completed
    //display button
});

Hope this helps!

Update:

$.getScript('http://platform.twitter.com/widgets.js', function(){ 
   //code 
});

Also, you can embed the iframe code version of twitter and facebook buttons instead of loading the js code each time, for example:

<iframe allowtransparency="true" 
        frameborder="0" 
        scrolling="no" 
        src="http://platform.twitter.com/widgets/tweet_button.html" 
        style="width:130px; height:50px;"></iframe>

Upvotes: 1

Related Questions