Skip to content Skip to sidebar Skip to footer

How To Add Facebook Like And Comments Box To Image Javascript

I want to add Facebook like button and comment box on my Blogger blog.Its a pictures blog which displays pictures using JavaScript. Recently I have implemented share button using F

Solution 1:

As I menthioned in your other post, I think I could found a way. The way based on this side. If you scroll the page until the end, you find comments from user OptiTool. I used it to develop a possible way.

What you have to do:

First insert the following javascript code into your page:

<scripttype="text/javascript">jQuery(document).ready(function()
    {
        $('#facebook_like').on('click', function() 
        {
            var fbURL = "http://www.facebook.com/plugins/like.php?href=";
            fbUR = fbUR + encodeURIComponent(pics[a]);
            fbUR = fbUR + "&send=false&layout=button_count&width=120&show_faces=false&action=like&colorscheme=light&font&height=21";
            var container = $(this).parent();
            var w = 120;
            var h = 27;
            fbFrame = document.createElement("IFRAME");
            fbFrame.setAttribute("src", fbURL);
            fbFrame.setAttribute("scrolling", "no");
            fbFrame.setAttribute("frameBorder", 0);
            fbFrame.setAttribute("allowTransparency", true);
            fbFrame.style.border = "none";
            fbFrame.style.overflow = "hidden";
            fbFrame.style.width = w;
            fbFrame.style.height = h;
            $(this).parent().empty().html(fbFrame);
        });
    });
    </script>

Make sure that you inserted it after you satement, where you import jquery.js.

Second:

Insert your own like button into your page, whereever you want. Then add the attribute id="facebook_like" to him.

Important! Because I haven't a n account at Facebook, I couldn't test it practically. So don't blame on me.

Post a Comment for "How To Add Facebook Like And Comments Box To Image Javascript"