Finished up follow button

This commit is contained in:
Victoria Wang 2014-10-14 23:27:33 -07:00
parent f2e57193dd
commit 600eefeecf
2 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,7 @@
var link = $('a#followLink');
var Site = { var Site = {
toggleFollow: function(siteId, csrfToken) { toggleFollow: function(siteId, csrfToken) {
var link = $('a#followLink')
$.post('/site/'+siteId+'/toggle_follow', {csrf_token: csrfToken}, function(res) { $.post('/site/'+siteId+'/toggle_follow', {csrf_token: csrfToken}, function(res) {
if(res.result == "followed") { if(res.result == "followed") {
link.addClass('is-following') link.addClass('is-following')
@ -9,4 +10,12 @@ var Site = {
} }
}) })
} }
} };
$('a#followLink').hover(function() {
if (link.hasClass('is-following')) {
$('a#followLink').addClass('unfollow');
}
}, function() {
$('a#followLink').removeClass('unfollow');
});

View file

@ -693,7 +693,7 @@ a.tag:hover {
display: none; display: none;
} }
} }
#followLink.is-following:hover { #followLink.is-following.unfollow {
.follow { .follow {
display: none; display: none;
} }