367 posts
  • Bought between 10 and 49 items
  • Denmark
  • Exclusive Author
  • Has been a member for 4-5 years
  • Microlancer Beta Tester
UI20 says

Hey I am having an issue rendering “dynamic” text from a twitter feed on my theme. The feed it placed in my footer and I have no issues replacing static text but when using the a JQUERY plugin for showing feeds it fails to render any of the text pulled in.

I have tried adding many of the html tags to the cufon replace code but none worked for the dynamic text.

I am using a test code I got in a theme I purchased on Themeforest but this problem is so urgent and not really related to the theme but the general solution of rendering cufon on dynamic text so I hope you guys can help me.

Here is the test HTML :

<script src="js/cufon_ie9.js" type="text/javascript"></script>
    <script src="js/ArdleysHand_500.font.js" type="text/javascript"></script>
    <script src="js/Gotham_Narrow_Light_300.font.js" type="text/javascript"></script>
    <script type="text/javascript">
      Cufon.replace('h2', { fontFamily: 'ArdleysHand' });
      Cufon.replace('#footer h3', { fontFamily: 'ArdleysHand' });
      Cufon.replace('#tagline h4', { fontFamily: 'ArdleysHand' });
      Cufon.replace('div#tweet-text', { fontFamily: 'ArdleysHand' });
</script>
<!--twitter widget -->
         <div data-username="pixilcase" id="twitter">
             <h3>Tweet Widget</h3>
             <span>loading...</span>
             <h4>line</h4>
             <p>Loading latest tweet - follow us here <a href="http://www.twitter.com/pixilcase">@pixilcasw</a></p>
         </div>
        <!-- end twitter widget-->
Output HTML :
<h3><cufon class="cufon cufon-canvas" alt="Tweet " style="width: 41px; height: 14px;"><canvas height="21" width="56" style="width: 56px; height: 21px; top: 0px; left: -4px;"></canvas><cufontext>Tweet </cufontext></cufon><cufon class="cufon cufon-canvas" alt="Widget" style="width: 42px; height: 14px;"><canvas height="21" width="55" style="width: 55px; height: 21px; top: 0px; left: -4px;"></canvas><cufontext>Widget</cufontext></cufon></h3>
<span><div class="tweet-created_at"><a href="http://www.twitter.com/pixilcase/status/100596048619249660">6 days ago</a></div></span>
<h4>line</h4>
<p><div class="tweet-text"><a href="http://twitter.com/Eleven2" class="tweet-mention">@Eleven2</a> Sounds good, waiting patiently :)</div></p>
The included files:
<script src="js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="js/twitter.js" type="text/javascript"></script>
2211 posts
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Exclusive Author
  • Germany
  • Has been a member for 4-5 years
  • Interviewed on the Envato Notes blog
+4 more
crozer says

Make sure that cufón styles the text after your twitter feed has loaded.

$(document).ready(function() {

// your twitter feed code

Cufon.replace(...);

});

And if that doesn’t work, try binding the twitter feed to a load function, so that only after it has fully loaded, the text is cufonized.


$(document).ready(function() {

function yourTwitterFeed() {

// the twitter feed run script

}

yourTwitterFeed.bind('load', function() {

Cufon.replace(...);

});

});

606 posts
  • Envato Staff
  • Blog Editor
  • Senior Reviewer
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Forum Moderator
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
+9 more
Siddharth Staff says

Crozer is on the money. Cufon renders itself as text only to elements it has been called on at the moment of calling. If you’re loading your tweets dynamically, they won’t get styled.

Run the replace method along with the loading process and it should work.

1475 posts The right tools with none of the gimmicks
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • United States
+1 more
PixelBin says

Or do a Cufon.refresh() after the tweets load (I think, haven’t used that thing in a while). Either way, there’s a refresh function that you can use, just have to find the right name of it if I’m wrong.

488 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

first of all, it’s a sunday of mid August and i could be on holiday more than this only in death.

now i can understand the urgency and all but that still doesn’t justify a flood of item comments, especially when we talk about item customization.

said so, edit twitter.js
// find this block
.find("p")
    .html(res.find(".tweet-text")[0])
.end()
.find("span")
    .html(res.find(".tweet-created_at")[0])
.end();
// add this line
Cufon.refresh();

not tested but should work.

BF

by
by
by
by
by
by