7

I have a twitter bootstrap table with a button group in the last cell of each row.

button group in a table cell

I want these buttons appear only when user hovers over the row. Also, when user hovers over the row (not over the button group itself) only icons should appear, and when he then hovers over the button group icons should be displayed like buttons.

enter image description here

Here is a fiddle with html layout I use http://jsfiddle.net/hDafj/

And this is what I tried to do already http://jsfiddle.net/hDafj/2

4

3 回答 3

10

我们可以做到这一点CSS

CSS

table.table tr td div.btn-group { display:none;}
table.table tr:hover td div.btn-group { display:inline-block;}

这是更新的小提琴

于 2013-06-27T09:46:52.237 回答
2

Well, I think that anyway you need some additional styles here. I've added .btn-group-hover class to make the buttons' borders, shadow and background white (this way they will always be the same size). All .icon-white icons also should be treated separately to avoid them appearing white on white background on row hover. Here is my suggested solution: http://jsfiddle.net/hDafj/3/ But the only issue here is that it looks good only on white tr background.

于 2013-06-27T10:06:39.797 回答
0

试试这个http://jsfiddle.net/guyisra/hDafj/5/这可能会帮助你开始(需要修复对齐,你可以自己解决

使用js为行悬停添加类和css

$(".btn-group a").hover(function () {
    $(this).addClass("btn");
}, function () {
    $(this).removeClass("btn");
}

);

css

.btn-group {
    visibility:hidden;
}
table tr:hover .btn-group {
    visibility:visible;
}
于 2013-06-27T10:10:41.007 回答