367 posts
  • Has been part of the Envato Community for over 5 years
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Located in Denmark
+1 more
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>
2254 posts Digital Artist
  • Had an item featured in a magazine
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has referred 200+ members
+12 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(...);

});

});

611 posts
  • Member of the Envato Team
  • Had an item featured in an Envato Bundle
  • Made it to the Authors' Hall of Fame
  • Contributed a blog post
+10 more
Siddharth Envato team 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.

1479 posts The right tools with none of the gimmicks
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+6 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.

501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by