Stylize Your Digg Count
By Leon Chevalier2008-04-22
Starting the digg count
Finally, we have to decide when run the diggQuery JavaScript. For the examples on this page, I just added the code to the onlick attribute of the link. You probably won’t want the count to display after a click though, you’ll want it to display after the page loads. As we’re using Prototype, we can use this technique:
<script type=”text/javascript”>
document.observe(”dom:loaded”, function() {
new diggQuery({opacity:50,link_css:’p.digg_para’,box_type:’image_only’,pad_links:true})
});
</script>
document.observe(”dom:loaded”, function() {
new diggQuery({opacity:50,link_css:’p.digg_para’,box_type:’image_only’,pad_links:true})
});
</script>
Just add this code between your page HEAD tags and once the document is loaded, the digg counts will appear. Of course, you will have to change the options as explained in ‘Which links get a digg count?’ so that only your desired links get a count.
Tutorial Pages:
» What’s a digg count?
» The Example
» The Digg API
» A PHP Example
» A class to query the API
» An AJAX Example
» Which links get a digg count?
» Starting the digg count
» Downloads
