jquery - 下拉面板的名称

标签 jquery css

请问这是什么下拉面板?
Link

它在最佳家庭 PC 列表中。当你点击一个元素时,它会下拉其他内容

我想做,但我不知道它叫什么,所以我可以搜索教程...

最佳答案

这是一个定制的但一个简单的概念。有一个 div 作为“标题”和一个带有详细信息的 subsecuent。使用 jQuery 检测事件并找到 div 以显示详细信息。我做的很简单 example为了简化概念:

jQuery:

$(document).ready(function(){
$(".toggle div:not('.noaction')").click(function(){
    $(this).parent().next().slideToggle();
});

$(".anoterAction").click(function(event){
    event.preventDefault();
    $parent=$("#"+$(this).attr('data-parent'));
    $parent.addClass('dontOpen');
    alert("another action!");


});

});

HTML

<div class="toggle" id="1">
<div>Just one row</div>
<div>Just another one row</div>
<div class="noaction"><a class="anoterAction"  data-parent="1" href="">Maybe a link that make another action!</a></div>
</div>
<div class="details">
<p>You can put all details here</p>
</div>
<div class="toggle" id="2">
<div>Just one row</div>
<div>Just another one row</div>
<div><a class="anoterAction" href="">Maybe a link that make another action!</a></div>
</div>
<div class="details">
<p>Other detail for other row</p>
</div>

CSS

.details
{
    display:none;
    border:1px solid #444;
    background: #e1e1e1;
    border-top:none;
    padding:20px;
}

.toggle
{
   display:block;
   border:1px solid #ccc;
   background: #eee;
   margin-top: 10px;
   padding:10px;
}

.toggle div
{
   display:inline-block;
}

关于jquery - 下拉面板的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25960528/

相关文章:

jquery - 为什么jqueryui.dialog选中的元素是表格时会忽略height参数?

jquery - 单击时增加整个元素的字体大小

jquery - 使部分输入[文本]变灰?

css - 具有内容自动宽度的下拉导航栏

css - Bootstrap 媒体列表,如何让元素水平滚动?

javascript - 使用 css 或 jquery 在子类上添加样式

javascript - 当可排序被丢弃时会发出警报

jquery - 根据带菜单的部分滑动页面

jquery - 关于 Div 的问题;悬停,事件,内容

javascript - Angular 绑定(bind)在 Chrome/Opera 中不起作用