Search code examples
jqueryfacebookcover

facebook cover as div background


Well s the title says I just want to use the facebook cover as background for some div in a website, so whenever I update my cover it automatically updates the image on the site.

in another thread somebody said that was really easy, but I donut have the skills in jQuery to do the code can someone help me with this?

The mentioned thread: How to setup Facebook Timeline Cover Photo website . is it easy for a basic web developer?

Thanks in advance


Solution

  • Just replace MY_FACEBOOK_URL_NAME with whatever yours is or your graph user id number.

    $.getJSON('http://graph.facebook.com/MY_FACEBOOK_URL_NAME?fields=cover&callback=?', function(data){
        $('#myDiv').css('background-image','url(' + data.cover.source + ')');
    });