Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically loading Twitter widget using jquery
    primarykey
    data
    text
    <p>I'm working on a website where we want a little Twitter logo in the corner, that when clicked will show the <a href="http://www.stevemid.co.uk/twitterwidget.txt" rel="nofollow">standard Twitter Widget</a> in a box that 'pops out' of the little 24x24 logo (and toggles to hide).</p> <p>I managed it ok with jquery, but I realised that it is quite slow, and thought that as most people won't be clicking on this image, the widget should be dynamically loaded only if needed.</p> <p>But I seem to have reached the end of my limited jquery expertise, so would appreciate some help.</p> <p>My attempt so far:</p> <pre><code>&lt;div id = "twittertoggle"&gt;&lt;img src="images/Twitter_logo.png" alt="David's Twitter feed" id="twibble" /&gt;&lt;/div&gt; &lt;div id = "twitterwidget"&gt;Widget to go in this DIV.&lt;/div&gt; &lt;script language="javascript" &gt; $('#twitterwidget').hide(); // hide the container DIV on load $('#twibble').bind('click', function() { // event for clicking on the twitter logo $('#twitterwidget').toggle(); // toggle show or hide the widget container DIV $.getScript('http://widgets.twimg.com/j/2/widget.js', function() { // attempt to load the JS for the widget $.getScript('twitterwidget.js'); // fail horribly. }); }); &lt;/script&gt; </code></pre> <p>I placed the following code into the 'twitterwidget.js' file:</p> <pre><code>new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 6000, width: 320, height: 340, theme: { shell: { background: '#b0b0b0', color: '#ffffff' }, tweets: { background: '#f7f4f7', color: '#474647', links: '#a16d99' } }, features: { scrollbar: false, loop: false, live: false, hashtags: true, timestamp: true, avatars: false, behavior: 'all' } }).render().setUser('TWITTERUSERNAME').start(); </code></pre> <p>I have tried many, many different ways to get this to work (probably 2-3 hours) but I'm now thoroughly stuck, so some advice would be appreciated, thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload