Making Facebook Share Button Fit In

The share buttons that are currently offered by sites such as Digg, Facebook and Tweetmeme all have something in common when it comes to their height. 61px seems to be a developing standard.

The problem is that when you line them all up the Facebook share button is actually wider than the others which seem to come in at 52px.

Well you can make the Facebook button 52px in width without too much trouble. Facebook only use two classes to style the inner ‘Share’ button which seems to be the decider when it comes to the buttons width.

By shaving a little off the left and right padding we can bring the Facebook share button back down to 52px in width and make it play nice with the other share buttons.


The extra span is just enough to beat the included Facebook css with a higher specificity score by 1 single point.

[carousel keywords=”facebook development” tag=”fetchit-21″]

How To Create A Fluid Facebook Publisher Interface

Facebook recently changed their publisher inface, again.

The publisher interface is what you see on all profile pages and on your home page. It is how you change your status, and can use it to publish link and photos too. The final option is to use one of you applications who offer a publisher.

Because the publisher is now used on the home and profile pages which have different widths, and Facebook have yet to document any explanation of how to make your publisher interface inline easily I spend a bit of time tinkering.

Continue reading

Facebook FBJS basics

Just a post about the most basic parts of Facebook built in canvas Javascript library which they has called FBJS (Facebook Javascript).

To protect themselves from the more evil developers Facebook have introduced Javascript in a limited and controlled way. You can still do most things you can in Javascript but mainly using getter and setter function.

Accessing elements and walking the DOM

You can still use many of the standard methods for accessing and navigating the DOM.

document.getElementById(id) // as you would expect
document.getRootElement() // gets the highest dom tree element accessible to canvas page developers
document.creatElement('DIV') // would create a new div element
document.getElementsByTagName('DIV') // returns all div elements

I would suggest setting up a base function to save yourself some repetition

function byId(id)
{
    return document.getElementById(id)||false;
}

Facebook use getters and setters for many Javascript functions including

byId('id').getNextSibling(); // same as .nextSibling;
byId('id').getPreviousSibling(); // same as .previousSibling;
byId('id').getFirstChild(); // same as .firstChild;
byId('id').getLastChild(); // same as .lastChild;
byId('id').getParentNode(); // same as .parentNode;
byId('id').getChildNodes(); // same as .childNodes;

Manipulating Elements

byId('id').appendChild(node); // as .appendChild(node);
byId('id').insertBefore(node,caret); // as .insertBefore(node,caret);
byId('id').removeChild(node); // as .removeChild(node);
byId('id').replaceChild(node);
byId('id').cloneNode(tree); // as .cloneNode(tree);

Manipulating Tags and Attributes

byId('id').setTextValue(text); // innerHTML with text only

byId('id').setValue(value); // as .value=newValue;
byId('id').getValue(); // as .value;