These demos show how you can completely customize the look and feel of the foobar by changin the various options as desired. Click on a tab to view the different customization demos.
CSS:
.custom-bg .foobar-container {
background:url(dotted_bg.png) repeat-x;
}
Javascript:
$foobar({
"height" : {
"bar" : 100, "button" : 30
},
"width": {
"left": "0", "center": "*",
"right": "0", "button": "80px"
},
"display" : {
"backgroundColor" : "transparent",
"border": "solid 3px #000",
"button": {
"backgroundColor": "#800"
},
"theme": {
"bar": "x-white custom-bg"
}
},
"messages": [
"Woo hoo - look how good this bar looks!",
"There are no limits to the possibilities!"
],
"message": {
"font": {
"color": "#ff0",
"size": "24px",
"shadow": "1px 1px 0 #444",
"weight": "bold"
}
}
});
CSS:
.bottom h1 {
font:bold 34pt arial;
color:#9cf;
margin:0;
text-shadow:#64665b 0px 2px 1px;
}
.bottom p {
color:#56584e;
font-size:20px;
font-style:italic;
text-shadow:#f0f3d8 0px 1px 1px;
}
Javascript:
$foobar({
"height" : {
"bar" : 120, "button" : 30
},
"width": {
"left": "0", "center": "*",
"right": "0", "button": "80px"
},
"position": {
"bar": "bottom"
},
"display" : {
"type" : "delayed",
"delay" : 1000,
"speed": 100,
"backgroundColor" : "#ffe9b0"
},
"messages": [
"<div class='bottom'><h1>Purchase Now!</h1><p>WOW - this is at the bottom!</p></div>",
"<div class='bottom'><p>The foobar now works at the bottom. The foobar is awesome!</p></div>"
],
"message": {
"delay": 2000,
"fadeDelay": 500,
"navigation": true
}
});
PLEASE NOTE : when you close this foobar, it closes completely and does not show the expand button.
This is done by setting the display.button.type option to "close". To show the foobar again, click the current tab.
HINT : You can also set the foobar to 'remember' state by setting the cookie options, so if a visitor closes the foobar, it stay's closed.
Javascript:
$foobar({
"height" : {
"bar" : 50, "button" : 30
},
"width": {
"left": "0", "center": "*",
"right": "0", "button": "80px"
},
"display" : {
"button": { "type": "close" },
"backgroundColor" : "#888",
"theme": {
"bar": "x-white"
}
},
"messages": [
"<img width='917' height='50' src='demo-banner.png' title='some ridiculous offer' />"
]
});
This demo loads your social buttons into the foobar. The script to load the buttons is listed below the foobar initialization code.
CSS:
.buttons_loading { display:block; width:117px; height:32px; background:url(throbber.gif) no-repeat center center; }
ul.socialbuttons { height: 32px; padding: 0 !important; margin:0 !important; }
ul.socialbuttons li { padding:6px !important; float: left; list-style: none !important; }
Javascript:
$foobar({
"height" : {
"bar" : 32
},
"width": {
"left": "500px", "center": "*",
"right": "0", "button": "80px"
},
"display" : {
"button": { "type": "toggle" },
"backgroundColor" : "#369",
"theme": {
"bar": "x-white"
}
},
"leftHtml" : "<div class='buttons_loading' id='social_target'></div>",
"messages": [
"Spread the love", "Share this post with your friends"
]
});
initDemo4Buttons();
function initDemo4Buttons() {
var url = window.location;
//replace this with your facebook app ID
var facebook_app_id = '125102657580278';
var $target = $("#social_target");
if ($target.hasClass("buttons_loading")) {
var $ul = $('<ul class="socialbuttons"></ul>');
$target.append($ul);
//add facebook HTML
var $facebook_li = $('<li/>').hide()
.append('<iframe src="http://www.facebook.com/plugins/like.php?app_id='+facebook_app_id+'&href='+encodeURIComponent(url)+'&send=false&layout=button_count&width=90&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>')
.appendTo($ul);
var tweet = 'FooBar - the unobtrusive jQuery notification bar that doesnt suck';
var twitter = 'themergency';
//add tweet HTML
var $twitter_li = $('<li/>')
.hide()
.append('<a href="http://twitter.com/share" class="twitter-share-button" data-url="'+url+'" data-text="'+tweet+'" data-count="horizontal" data-via="'+twitter+'">Tweet</a>')
.appendTo($ul);
//add google+1 HTML
var $google_li = $('<li/>')
.hide()
.append('<g:plusone size="medium" href="'+url+'" count="true"></g:plusone>')
.appendTo($ul);
var $stumble_li = $('<li/>')
.hide()
.append('<div id="socialprogress-su"></div>')
.appendTo($ul);
var $linked_li = $('<li/>')
.hide()
.append('<scr'+'ipt type="in/share" data-url="'+url+'" data-counter="right"></scr'+'ipt>')
.appendTo($ul);
//load twitter script
$.getScript('http://platform.twitter.com/widgets.js', function() {
// Load Google Plus script
$.getScript('https://apis.google.com/js/plusone.js', function() {
// Load StumbleUpon script
$.getScript('http://www.stumbleupon.com/hostedbadge.php?s=2&r='+url+'&a=1&d=socialprogress-su', function() {
// Load LinkedIn script
$.getScript('http://platform.linkedin.com/in.js', function() {
$target.removeClass("buttons_loading");
$facebook_li.show();
$linked_li.show();
$stumble_li.show();
$google_li.show();
$twitter_li.show(); //show it
});
});
});
});
}
}
This demo is similar to demo 4, but these social icons are big. Again the code to include the social buttons is below the foobar code.
CSS:
ul.socialbuttonsbig { padding: 0 !important; margin:0 !important; }
ul.socialbuttonsbig li { padding:6px !important; float: left; list-style: none !important; }
#social_target2 { margin:auto 0; width:200px }
.social-big-demo .foobar-container-left { background:url(social_big.png) no-repeat center center; }
Javascript:
$foobar({
"height" : {
"bar" : 75
},
"width": {
"left": "*", "center": "350px",
"right": "*", "button": "80px"
},
"display" : {
"button": { "type": "toggle" },
"backgroundColor" : "#369",
"theme": {
"bar": "x-white social-big-demo"
}
},
"messages" : ["<div class='buttons_loading' id='social_target2'></div>"]
});
initDemo5Buttons();
function initDemo5Buttons() {
var url = window.location;
//replace this with your facebook app ID
var facebook_app_id = '125102657580278';
var $target = $("#social_target2");
if ($target.hasClass("buttons_loading")) {
var $ul = $('<ul class="socialbuttonsbig"></ul>');
$target.append($ul);
//add facebook HTML
var $facebook_li = $('<li/>').hide()
.append('<iframe src="http://www.facebook.com/plugins/like.php?app_id='+facebook_app_id+'&href='+encodeURIComponent(url)+'&send=false&layout=box_count&width=45&show_faces=false&action=like&colorscheme=light&font&height=64" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:45px; height:64px;" allowTransparency="true"></iframe>')
.appendTo($ul);
var tweet = 'FooBar - the unobtrusive jQuery notification bar that doesnt suck';
var twitter = 'themergency';
//add tweet HTML
var $twitter_li = $('<li/>')
.hide()
.append('<a href="http://twitter.com/share" class="twitter-share-button" data-url="'+url+'" data-text="'+tweet+'" data-count="vertical" data-via="'+twitter+'">Tweet</a>')
.appendTo($ul);
//add linked-in HTML
var $linked_li = $('<li/>')
.hide()
.append('<scr'+'ipt type="in/share" data-url="'+url+'" data-counter="top"></scr'+'ipt>')
.appendTo($ul);
//add google+1 HTML
var $google_li = $('<li/>')
.hide()
.append('<g:plusone size="tall" href="'+url+'" count="true"></g:plusone>')
.appendTo($ul);
//add stumble upon HTML
var $stumble_li = $('<li/>')
.hide()
.append('<div id="socialprogressbig-su"></div>')
.appendTo($ul);
//load twitter script
$.getScript('http://platform.twitter.com/widgets.js', function() {
// Load Google Plus script
$.getScript('https://apis.google.com/js/plusone.js', function() {
// Load StumbleUpon script
$.getScript('http://www.stumbleupon.com/hostedbadge.php?s=5&r='+url+'&a=1&d=socialprogressbig-su', function() {
// Load LinkedIn script
$.getScript('http://platform.linkedin.com/in.js', function() {
$target.removeClass("buttons_loading");
$facebook_li.show();
$linked_li.show();
$stumble_li.show();
$google_li.show();
$twitter_li.show(); //show it
});
});
});
});
}
}
This demo shows a newsletter opt-in form in the foobar.
CSS:
.subscribe-demo .foobar-container-center { background:url(subscribe.png) no-repeat left center; height:100px;}
#subscribeform { padding-left:320px; }
#subscribeform span { position: relative; display: block; float: left; }
#subscribeform label { position: absolute; top: 0; left: 0; font-size: 15px; padding-left: 5px;
line-height: 35px; color: #666; cursor:text; }
.subscribeInput { border: 1px solid #E5E5E5; font-size: 15px; height:30px; padding-left: 5px;
margin-right:10px; outline: none; width: 150px; color:#000; float:left;
-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
.subscribeSubmit { width:120px; height:34px; border:0px; background:#f44; display:inline-table;
color:#fff; cursor:pointer; font-size:14px; position:relative; text-shadow:0 2px 2px rgba(0, 0, 0, .4);
font-weight:bold; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
Javascript:
var html = "<div id='subscribeform'><span><label for='name'>Name</label>";
html += "<input id='name' class='subscribeInput' type='text' name='name' value=''></span>";
html += "<span><label for='email'>Email</label>";
html += "<input id='email' class='subscribeInput' type='text' name='email' value=''></span>";
html += "<input class='subscribeSubmit' type='submit' value='Sign Me Up!'></div>";
$foobar({
"height" : {
"bar" : 100
},
"width": {
"left": "*", "center": "900px",
"right": "*", "button": "80px"
},
"display" : {
"button": { "type": "toggle" },
"backgroundColor" : "#320070",
"theme": {
"bar": "x-white subscribe-demo"
}
},
"messages" : [ html ],
"events": {
"postRender" : function(settings) {
$('#subscribeform label').inFieldLabels();
}
}
});