别人是如何复制使用Twitter的引导Twitter的网站跟踪/停止追随悬停动作? [英] How could someone replicate the Follow/Unfollow hover action on Twitter's website using Twitter Bootstrap?

查看:157
本文介绍了别人是如何复制使用Twitter的引导Twitter的网站跟踪/停止追随悬停动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你看你下面就微博,按键从跟随变为取消关注切换(从谁绿转红,并从检查标记x标记的变化)。

When you look at who you're following on Twitter, the buttons change from Follow to Unfollow (switch from green to red AND change from check-mark to x-mark).

我将如何复制这一在我的网站?我意识到这可能是引导,CSS和引导,buttons.js的组合,但我不能看着办吧......

How would I replicate this on my website? I realize it's probably a combination of bootstrap-css and bootstrap-buttons.js, but I can't figure it out...

推荐答案

引导-buttons.js是Twitter的引导的新功能。但你也可以做手工使用jQuery。

bootstrap-buttons.js is a new feature in Twitter Bootstrap. But you can also do it manually using jQuery.

下面是一个按钮(绿色)

Here's a button (green)

<a href="#" class="follow btn success" onmouseover="change_btn();">&check; Following</a>

现在,您需要更改悬停按钮的类别和内容,

now, you need to change the class and content of the button on hover,:

// Javascript File
function change_btn(){

$('.follow').removeClass("success");
$('.follow').addClass("danger");
$('.follow').html("&cross; UnFollow");

}

该脚本将删除,并添加类来改变按钮的背景,也改变了它的内容。

This script will remove and add classes to change the background of the button and also changes the content in it.

这篇关于别人是如何复制使用Twitter的引导Twitter的网站跟踪/停止追随悬停动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆