367 posts
  • 6 Years of Membership
  • Beta Tester
  • Collector Level 2
  • 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>
2258 posts Digital Artist
  • Front Page Master
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+15 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(...);

});

});

614 posts
  • Envato Team
  • Tuts+ Instructor
  • Weekly Top Seller
  • Bundle Boss
+11 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
  • Affiliate Level 4
  • Author Level 7
  • Beta Tester
  • Collector Level 2
+7 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
  • Affiliate Level 7
  • Author Level 10
  • Collector Level 2
  • Top Monthly Author
+10 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