I change the text for tweet button but when I change attributes is generating a blink effect


#1

Here is the code to see the blink effect
http://jsfiddle.net/chris27/DQw5b/4/

Thank you very much and sorry if is a newbie thing but I didn’t find anything in internet.


#2

The flicker is caused by removing and initializing a new widget. The DOM is redrawing between the embed code being embedded and the iframe being initialized.

Although the redraw is inevitable for now, you could probably improve it by using the direct creation fuction, like so:

twttr.widgets.createShareButton(
http://test.com’,
$(’#tweetBtn’)[0],
undefined,
{ text: $(’#tweetText’).val() }
);

It’s still drawing a new element on the page, so some browsers might still flicker, depending on their redraw implementation.

Another way to handle this is to not use the Tweet Button widget, and instead reference the Web Intent URL directly from your button or a link, which will allow you to update the text attribute without redrawing.

Ben


#3