jQuery Follow/Following Buttons
http://forrst.me/jakiestfu
HTML
<button class='follow'>Follow</button>
CSS
.follow
{
background: rgba(120,120,120,0.4);
color: #333333;
padding: 5px 12px;
text-decoration: none;
}
.follow:hover
{
background: rgba(120,120,120,0.7);
cursor: pointer;
}
.unfollow
{
background: rgba(120,120,120,0.7);
}
JavaScript
$(".follow").live('click', function(e){
e.preventDefault();
$button = $(this);
if($button.hasClass('unfollow')){
//$.ajax(); Do Unfollow
$button.removeClass('follow');
$button.removeClass('unfollow');
$button.text('Follow');
} else {
// $.ajax(); Do Follow
$button.addClass('follow');
$button.text('Unfollow');
}
});