我有一些东西可以将一个被选中的单元格弹出到包含它的行的正上方的一行,使其成为全角。这和你要找的很接近吗?如果是这样,您将需要混合使用 CSS 和 JS,并修改您的 HTML 以适应这种情况。这件事做了很多次(并且不得不重做以满足客户/客户的期望),这就是我经常做的事情。看看这个小提琴 here
HTML
<ul class="results">
<div class="detail hide"></div>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<ul class="results">
<div class="detail hide"></div>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<ul class="results">
<div class="detail hide"></div>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
CSS
.results{
background-color: yellow;
margin: 0;
padding: 0;
position:relative;
height:auto;
overflow: visible;
width:652px;
display:block;
list-style: none;
}
.results li {
background-color:red;
padding: 0;
width:200px;
height:140px;
display:inline-block;
margin:7px;
list-style-type: none;
cursor:pointer;
-webkit-transition: all .5s linear;
-moz-transition: all .5s linear;
-ms-transition: all .5s linear;
-o-transition: all .5s linear;
transition: all .5s linear;
}
.detail{
background-color:orange;
padding: 7px;
width:624px;
position:relative;
top:7;
visibility:visible;
left:auto;
opacity: 1;
margin:0 7px 7px 7px;
cursor:pointer;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-ms-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
}
.hide{
visibility:hidden;
opacity: 0;
position:absolute;
}
.fade{
opacity: .2;
}
jQuery
$(document).ready(function () {
'use strict';
var $getDetails = $('.results div'),
$getLis = $('.results li');
$('.results').on('click', 'li', function() {
$getLis.removeClass('fade');
$getDetails.addClass('hide').empty();
$(this).siblings('div')
.html($(this).html())
.addClass('hide')
.removeClass('hide');
$(this).addClass('fade');
});
$('.results').on('click', '.detail', function() {
$getDetails.addClass('hide').empty();
$getLis.removeClass('fade');
});
});