One Time Facebook Pop Up Like Box For Blogger


| | 47 comments
Last September i published a post showing How to add a one time Email Rss subscription pop up on Blogger.Since then i have had a number of requests for a similar gadget but with a Facebook page like box instead of the Email form.So in this post we have just that.When a visitor lands on your blog a pop up box will appear with the option to like your Facebook page.The gadget will only appear on the first visit so your readers or you wont have to see it every time.

For this i have used the gadget from the great MyBloggerTricks making just a few small changes.Check out the demo and screenshot below.

View Demo Button


Remember Always Back Up Your Template Before You Make Changes - How To Back Up A Blogger Template

Step 1. In Your Blogger Dashboard Click Design > Add a gadget > Choose html/javascript.







Step 2. Copy and Paste the following code into the Html/Javascript gadget, there is a lot of code make sure to get it all :

<style>

/*
ColorBox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block;}
.cboxIframe{width:100%; height:100%; display:block; border:0;}
/*


User Style:
Change the following styles to modify the appearance of ColorBox. They are
ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#000;opacity:0.5 !important;}
#colorbox{
box-shadow:0 0 15px rgba(0,0,0,0.4);
-moz-box-shadow:0 0 15px rgba(0,0,0,0.4);
-webkit-box-shadow:0 0 15px rgba(0,0,0,0.4);
}
#cboxTopLeft{width:14px; height:14px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) no-repeat 0 0;}
#cboxTopCenter{height:14px; background:url(http://1.bp.blogspot.com/-TcJGMnSfOCY/TxrtzzHDLVI/AAAAAAAAFWc/mdndgrisRuA/s1600/border.png) repeat-x top left;}
#cboxTopRight{width:14px; height:14px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) no-repeat -36px 0;}
#cboxBottomLeft{width:14px; height:43px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) no-repeat 0 -32px;}
#cboxBottomCenter{height:43px; background:url(http://1.bp.blogspot.com/-TcJGMnSfOCY/TxrtzzHDLVI/AAAAAAAAFWc/mdndgrisRuA/s1600/border.png) repeat-x bottom left;}
#cboxBottomRight{width:14px; height:43px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) no-repeat -36px -32px;}
#cboxMiddleLeft{width:14px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) repeat-y -175px 0;}
#cboxMiddleRight{width:14px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) repeat-y -211px 0;}
#cboxContent{background:#fff; overflow:visible;}
#cboxLoadedContent{margin-bottom:5px;}
#cboxLoadingOverlay{background:url(http://1.bp.blogspot.com/-PPvu-446sn4/Txrt1QsGH1I/AAAAAAAAFWw/_jWYVoR1HX8/s1600/loading-background.png) no-repeat center center;}
#cboxLoadingGraphic{background:url(http://1.bp.blogspot.com/-31strss_1-E/Txrt1J6NThI/AAAAAAAAFWo/4P12CJPj924/s1600/loading.gif) no-repeat center center;}
#cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;}
#cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{position:absolute; bottom:-29px; background:url(http://1.bp.blogspot.com/-FiJ_Xz7txEg/Txrt0sy1TiI/AAAAAAAAFWk/Llzvkeyy_J8/s1600/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;}
#cboxPrevious{left:0px; background-position: -51px -25px;}
#cboxPrevious.hover{background-position:-51px 0px;}
#cboxNext{left:27px; background-position:-75px -25px;}
#cboxNext.hover{background-position:-75px 0px;}
#cboxClose{right:0; background-position:-100px -25px;}
#cboxClose.hover{background-position:-100px 0px;}
.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
.cboxSlideshow_on #cboxSlideshow.hover{background-position:-150px 0px;}
.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
.cboxSlideshow_off #cboxSlideshow.hover{background-position:-125px 0px;}
/*-----------------------------------------------------------------------------------*/
/* Facebook Likebox popup For Blogger
/*-----------------------------------------------------------------------------------*/
#subscribe {
font: 12px/1.2 Arial,Helvetica,san-serif; color:#666;
}
#subscribe a,
#subscribe a:hover,
#subscribe a:visited {
text-decoration:none;
}
.box-title {
color: #3B5998;
font-size: 20px !important;
font-weight: bold;
margin: 10px 0;
border:1px solid #ddd;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
box-shadow: 5px 5px 5px #CCCCCC;
padding:10px;
line-height:25px; font-family:arial !important;
}
.box-tagline {
color: #999;
margin: 0;
text-align: center;
}
#subs-container {
padding: 35px 0 30px 0;
position: relative;
}
a:link, a:visited {
border:none;
}
.demo {
display:none;
}
</style>

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'></script>
<script src="http://yourjavascript.com/11215013191/jquery.colorbox-min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
if (document.cookie.indexOf('visited=true') == -1) {
var fifteenDays = 1000*60*60*24*30;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$.colorbox({width:"400px", inline:true, href:"#subscribe"});
}
});
</script>
<!-- This contains the hidden content for inline calls -->

<div style='display:none'>
<div id='subscribe' style='padding:10px; background:#fff;'>
<h3 class="box-title">Receive all updates via Facebook. Just Click the Like Button Below<center><p style="line-height:3px;" >▼</p></center></h3>
<center>

<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fspiceupyourblog&amp;width=300&amp;colorscheme=light&amp;show_faces=true&amp;border_color=%23ffffff&amp;stream=false&amp;header=false&amp;height=258" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:258px;" allowtransparency="true"></iframe>

</center>
<p style=" float:right; margin-right:35px; font-size:9px;" >Powered By | <a style=" font-size:9px; color:#3B78CD; text-decoration:none;" href="http://www.spiceupyourblog.com">Blog Gadgets</a> Via <a style=" font-size:9px; color:#3B78CD; text-decoration:none;" href="http://www.mybloggertricks.com">Blogger Widgets</a></p>
</div>
</div>

Important - You have two ways to make it work for your blog, firstly Change spiceupyourblog highlighted in yellow with your facebook username.Find more information on creating a professional Facebook page and username here.Or if your page does not have a simple username you can create your like box here and replace the code in bold above with the code you get.

Important 2 - If you already have jQuery script in your template remove the line in red.

That's it a cool Facebook pop up widget that will surly increase your facebook fan count.Thanks again to MBT for the original gadget.Make sure to check out more of our Facebook Tips And Gadgets.

Drop Your Comments And Questions Below.
If You Enjoyed This Post Please Take 5 Seconds To Share It.

Stay Connected With Free Updates

Subscribe via Email

47 comments:

  1. Great!!! is there any way to show customization in mobile theme, like adding fb like button...

    ReplyDelete
  2. From my experience.. this gadget won't work if our template contains javascript 1.4.2 .. is there any way to fix it, Paul?

    ReplyDelete
  3. Thanx!!
    I have patiently waited for this and have now implemented it in my blog-it works!
    Thanx 4 ur awesome work.

    ReplyDelete
  4. Forgot to ask... do you mind doing a tutorial on the different ways one can make their blog header (the part with the 'HOME' 'CONTACT' 'ABOUT'...) look as good as yours? Thanx!

    ReplyDelete
  5. Thanks , It Works! This is the thing I'm finding for! ^^

    ReplyDelete
  6. it keeps telling me to verify the correct href ?

    ReplyDelete
  7. There is some problem, in the style code or script; because blogger shows "Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
    XML error message: The entity name must immediately follow the '&' in the entity reference.

    Error 500"

    Any suggestion?

    ReplyDelete
  8. @ Jason and Ankit - I checked the code again and it's working fine, ther is a lot of code so make sure you get it all.

    ReplyDelete
  9. I've added the code completely (double checked) but it doesn't work. Please check it out

    http://www.electrokill.info

    ReplyDelete
  10. its nice widget..thanks but please tell me..how do it shows to visitor once on everyday.?

    ReplyDelete
  11. Hello,
    Will this code for a drupal site?
    Or can we modify it to work for that?

    ReplyDelete
  12. Will this still work if the Facebook page doesn't have a "username"? It says you are only eligible for a username once you have 25 fans. Can I just use the URL instead? Thanks, this is really cool.

    ReplyDelete
  13. Your demo's not working for me - not quite sure why.

    Also, can you explain how you can be sure it's one-time-only? Is it based on cookies (so will come back when they're cleared), or something else?

    ReplyDelete
  14. @ Eric - I visited your site and the pop up was there working fine.You will need to clear your cookies to see it again.

    @ Mary C - It uses cookies, you may have visited it before i had the demo on that page for a week before i published this post.

    @ AK - This is set up for blogger although you could get it to work on other sites.

    ReplyDelete
  15. Hi there, I'm still wondering now if I can use this with my facebook page's URL. I tried adding it that way, and the box pops up but something is wrong with the href.

    Could you please let me know if it is possible to use this if my facebook page doesn't have a username and only a URL?
    projectprocrastinot.blogspot.com

    ReplyDelete
  16. thank you! it works, i'm customizing my new second blog. its a big help. good job!

    ReplyDelete
  17. Ok, I figured out how to do it, I think, but how do we check to make sure it works if it's only a one time thing?
    Thanks again! I am loving the helpful info I find here and will keep coming back.

    ReplyDelete
  18. Hey I've cleared my cookies and used two different browsers, replaced your url with mine and it's still not working. It says the href is incorrect?

    ReplyDelete
  19. Sir, i didn't said that code is wrong , or there are error;
    Blogger shows error( which i wrote above) while saving the css code.
    Works fine when css code is linked using external stylesheet.

    ReplyDelete
  20. Great widget. I'm gonna incorporate this one on my blog: http://blogverize.blogspot.com

    ReplyDelete
  21. Great widget! It worked GREAT!!!!! But my slider stopped working afterwards. Any solutions? Please? Thanks!!!!!

    ReplyDelete
  22. hello sir. ty for the codes. it works find on me. but i want the closebox to be delete and put a timer on it . or else, others cant read my blog. its like forcing people to like my page first. hehe.can it be done?

    ReplyDelete
  23. Very nice widget.
    Would you know how to use this on a wordpress powered site?

    ReplyDelete
  24. Hello there...
    i have just installed this widget and checked the code.. but its not working on my blog please help
    www.techamy.blogspot.com

    ReplyDelete
    Replies
    1. The code is definitely working as it's the same as in the demo.Remember you will only see this once unless you clear your cookies..

      Delete
  25. I've added subscription pop up instead of this. How have you added photos against names in comment section? Thanks!

    ReplyDelete
  26. It Works but the slider tab has stock-up. :(

    ReplyDelete
  27. Thank you very very very much , Its working Greatttttttttttttttt in my blog (http://fbcovers123.blogspot.com/

    ReplyDelete
  28. Thank you for the widget! It works great. Is there any way to activate it on the page exit?? That would be even better!

    ReplyDelete
  29. A very big thanks to you.
    nice post. working great.
    if any one has doubt can check @ www.zipgamez.blogspot.com

    ReplyDelete
  30. Thanks alot mate!!!! for this beautiful and helpfull javascript.. working fine!!! thumbs up!!!

    ReplyDelete
  31. Thank you for this great widget Paul. It's perfectly working but the thing is, the moving images from my blog won't move anymore, that's why I removed the pop-up, is there anything else I can do? My website is -- thesexyblogger.blogspot.com ;D


    ♥ x0x0xD, (.Sm69.)
    The Sexy Blogger

    ReplyDelete
    Replies
    1. Hi Marc, I would think this is because you have the jQuery script in your template twice.I have highlighted the jQuery code in this post, it's the line in red, remove that and save then it should not clash with your slider..

      Delete
    2. Hi Paul thanks for your reply ;D I tried it too, still, it won't work, I tried to use it back -- now it never work with or without the jQuery script.. so really sad about it.. but thanks anyways ;D


      ♥ x0x0xD, (.Sm69.)
      The Sexy Blogger

      Delete
  32. hello paul in my template i have a slider and after i put this widget it stop to work

    i have search the net, most of the people say that its in json not in jquery

    ReplyDelete
  33. Thanks for the amazing Tweak. [techchasse.blogspot.in]

    ReplyDelete
  34. Really Nice Post. Thanks! =)

    ReplyDelete
  35. is it possible to let it pop up on every Home Page load?Why does it pop up 1 times only?

    ReplyDelete
  36. is it possible to let it pop up on every Home Page LOAD?

    ReplyDelete
    Replies
    1. To have it appear every time remove *30 from this section - var fifteenDays = 1000*60*60*24*30;

      Delete
    2. followed the steps.Did not work.i tried refreshing the website but pop up box didn't appear.Please advise.

      Delete
  37. This comment has been removed by the author.

    ReplyDelete
  38. paul is there anyway to make the popup auto close after readers click LIKE my fanpage?

    ReplyDelete
  39. there is a problem with me i replace the facebook username correctly with my facebook username but it says wrong username do some thing help me

    ReplyDelete
  40. there is a problem with me to apply this gadget i replace the facebook username but it says wrong username but i replace it correctly helped

    ReplyDelete

Asking a question ? Make sure to click the subscribe by email link below the comment form to get notified of replies !