DYR
Posted weixin2623670713
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DYR相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>Let‘s Have fun</h1>
<button data-panelId=‘panel1‘ class="panel-button btn btn-primary" >按钮1</button>
<button data-panelId=‘panel2‘ class="panel-button btn btn-success" >按钮2</button>
<button data-panelId=‘panel3‘class="panel-button btn btn-info">按钮3</button>
<button data-panelId=‘panel4‘class="panel-button btn btn-warning">按钮4</button>
</div>
<div class="row">
<div class="col-xs-3">
<div id="panel1" class="panel panel-primary">
<div class="panel-heading">
#panel1
</div>
<div class="panel-body">
content
</div>
</div>
</div>
<div class="col-xs-3">
<div id="panel2" class="panel panel-primary">
<div class="panel-heading">
#panel2
</div>
<div class="panel-body">
content
</div>
</div>
</div>
<div class="col-xs-3">
<div id="panel3" class="panel panel-primary">
<div class="panel-heading">
#panel3
</div>
<div class="panel-body">
content
</div>
</div>
</div>
<div class="col-xs-3">
<div id="panel4" class="panel panel-primary">
<div class="panel-heading">
#panel4
</div>
<div class="panel-body">
content
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//为每个button添加点击事件
$(‘.panel-button‘).on(‘click‘,function(){
//获取动态被点击的button的自定义属性值
var panelId = $(this).attr(‘data-panelId‘);
//进行操作
$(‘#‘+panelId).toggle();
})
</script>
</body>
</html>
以上是关于DYR的主要内容,如果未能解决你的问题,请参考以下文章