bootstrap collapse MVC .net漂亮的折叠List

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Blog</title>
<link href="/Content/bootstrap.css" rel="stylesheet" />
<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/bootstrap.js"></script>
</head>
<body>
<div style="margin-top: 55px;">
<style>
.list-group {
margin-bottom: 0px;
}
.Title {
cursor: pointer;
margin: 1px 0;
padding: 5px 0;
} h2 {
margin-top: 0px;
}
</style>
<div class="col-md-2">
<div href="#collapseOne"
data-toggle="collapse" aria-controls="collapseOne" class="text-center btn-primary Title">
Classification<div style="float: right; margin-right: 5px;">
<span class="glyphicon glyphicon-chevron-up"></span>
</div>
</div>
<ul id="collapseOne" class=" list-group panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<li class="list-group-item"><span class="badge">1</span> <a onclick="collapseOneFind()" href="#">测试类型</a></li>
</ul>
<br />
<div data-toggle="collapse" style="cursor: pointer;" href="#collapseTwo" aria-controls="collapseTwo" class="Title text-center btn-primary">
Tag<div style="float: right; margin-right: 5px;">
<span class="glyphicon glyphicon-chevron-up"></span>
</div>
</div>
<ul id="collapseTwo" class=" list-group panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
</ul>
<br />
<div data-toggle="collapse" style="cursor: pointer;" href="#collapseThree" aria-controls="collapseThree" class="text-center btn-primary Title">
Date<div style="float: right; margin-right: 5px;">
<span class="glyphicon glyphicon-chevron-up"></span>
</div>
</div>
<ul id="collapseThree" class=" list-group panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
</ul>
<br />
</div>
<div class="col-md-10"> </div> </div>
<script>
function InitBlog(data) {
var strTemp = "";
for (var i = 0; i < data.length; i++) {
strTemp += ' <div class="btn-primary">';
strTemp += ' <h2>' + data[i].BlogTitle + '</h2>';
strTemp += ' </div>';
strTemp += '<div class="panel-body">';
strTemp += ' <div>';
strTemp += '<span style="color: #999;">' + data[i].CreateTime + '</span>';
if (data[i].Classifications!='') {
var ClassificationArr = data[i].Classifications.split(',');
for (var j = 0; j < ClassificationArr.length; j++) {
strTemp += ' |<a style="color: #999; text-decoration: none;" href="#">' + ClassificationArr[0] + '</a>'
}
}
strTemp += ' </div>';
strTemp += '<div style="margin:5px 0">';
strTemp += data[i].Content;
strTemp += ' </div>';
strTemp += ' </div>';
strTemp += ' <div>';
if (data[i].Tag.indexOf(',') > 0) {
var TagArr = data[i].Tag.split(',');
for (var k = 0; k < TagArr.length; k++) {
strTemp += ' <button type="button" class="btn btn-default btn-xs">';
strTemp += ' <span class="glyphicon glyphicon-star" aria-hidden="true"></span>' + TagArr[k];
strTemp += ' </button> ';
}
}
strTemp += ' </div>';
}
return strTemp;
} function ClassificationFind(obj) {
$.ajax({
type: 'get', async: true, url: '/Blog/ClassificationFind', dataType: 'JSON', data: { Str: $(obj).text() }, cache: false, success: function (data) {
$("#Content").html(InitBlog(data));
}
});
}
function TagFind(obj) {
$.ajax({
type: 'get', async: true, url: '/Blog/TagFind', dataType: 'JSON', data: { Str: $(obj).text() }, cache: false, success: function (data) {
$("#Content").html(InitBlog(data));
}
});
} function DateFind(obj) {
$.ajax({
type: 'get', async: true, url: '/Blog/DateFind', dataType: 'JSON', data: { Str: $(obj).text() }, cache: false, success: function (data) {
$("#Content").html(InitBlog(data));
}
});
}
$(document).ready(function () {
//绑定折叠List 数据源
$.ajax({
type: 'get', async: true, url: '/Blog/GetClassification', cache: false, dataType: 'JSON', success: function (data) {
var strTemp = "";
for (var i = 0; i < data.length; i++) {
strTemp += ' <li class="list-group-item"> <span class="badge">' + data[i].Num + '</span> <a onclick="ClassificationFind(this)" href="#">' + data[i].ClassificationName + '</a></li>';
}
$("#collapseOne").html(strTemp);
}
});
$.ajax({
type: 'get', async: true, url: '/Blog/GetTagName', cache: false, dataType: 'JSON', success: function (data) {
var strTemp = "";
for (var i = 0; i < data.length; i++) {
strTemp += ' <li class="list-group-item"> <span class="badge">' + data[i].Num + '</span> <a onclick="TagFind(this)" href="#">' + data[i].TagName + '</a></li>';
}
$("#collapseTwo").html(strTemp);
}
}); $.ajax({
type: 'get', async: true, url: '/Blog/GetCreateDate', cache: false, dataType: 'JSON', success: function (data) {
var strTemp = "";
for (var i = 0; i < data.length; i++) {
strTemp += ' <li class="list-group-item"> <span class="badge">' + data[i].Num + '</span> <a onclick="DateFind(this)" href="#">' + data[i].CreateDate + '</a></li>';
}
$("#collapseThree").html(strTemp);
}
}); $.ajax({
type: 'get', async: true, url: '/Blog/GetBlog', cache: false, dataType: 'JSON', success: function (data) {
var r = $("#Content").html();
$("#Content").html(r + InitBlog(data));
}
});
});
$(".Title").click(function () {
var r = $(this).attr('class');
if (r.indexOf("collapsed") > 0) {
$(this).find("span").attr("class", "glyphicon glyphicon-chevron-up");
} else {
$(this).find("span").attr("class", "glyphicon glyphicon-chevron-down");
}
});
</script>
</body>
</html>
bootstrap collapse MVC .net漂亮的折叠List的更多相关文章
- bootstrap插件学习-bootstrap.collapse.js
先看bootstrap.collapse.js的结构 var Collapse = function ( element, options ){} // 构造器 Collapse.prototype ...
- bootstrap collapse 无法收回
$(function () { //修复collapse不能正常折叠的问题 $(".collapsed").click(function () { var itemHref = $ ...
- TextBoxFor控件的扩展---Bootstrap在mvc上的应用
TextBoxFor控件的问题: 1:自带了样式,再用bootstrap样式会有冲突. 2:要加水印,js事件,限制输入长度比较麻烦. 因此需要对textboxfor控件进行扩展. 目标: 1:能使用 ...
- Bootstrap for MVC:Html.Bootstrap().TextBoxFor(model=>model.Name)
在上篇博文中提到最近比较忙,也打过招呼Orchard系列文章更新速度可能会放缓,但还是会继续写下去,主要原因在最近想着开发一个新的东西(系统?组件?),等有一定成果时会跟大家分享一些相关的东西,今天介 ...
- Bootstrap Collapse使用
参考 http://wrongwaycn.github.io/bootstrap/docs/javascript.html#collapse http://www.w3resource.com/twi ...
- Bootstrap 学习笔记11 按钮和折叠插件
复选框: <div class="btn-group" data-toggle="buttons"> <label for="se ...
- Android分享一款漂亮的折叠书架菜单
一个Android折叠书架菜单,效果极佳,给人的视觉感觉很好,便于使用. FoldingMenu
- 添加Bootstrap 到MVC项目中(vs2010)
环境:Visual Studio 2010 ASP.NET MVC3 手动添加: 下载地址:http://twitter.github.com/bootstrap/ 一个js,两个css,两张图 ...
- bootstrap ace MVC
<<html lang="en"><head> <meta charset="utf-8" /> <title& ...
随机推荐
- POJ 2418 Hardwood Species(STL在map应用)
职务地址:id=2418">POJ 2418 通过这个题查了大量资料..知道了非常多曾经不知道的东西. . .. 在代码中凝视说明吧. 代码例如以下: #include <ios ...
- .net与Java的WebService互调
本文记录一下.net与Java是如何进行Web Service的互相调用的. 1.准备工作 MyEclipse 10 JDK 1.6.0_13 Visual Studio 2012 .net fram ...
- Javascript J更深层次的理解avascript 基础知识
eval全局函数 dojo loader会看到如下的功能 var eval_ = new Function('return eval(arguments[0]);'); //Function 函 ...
- Java的进程内缓存框架:EhCache (转)
EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider. Ehcache缓存的特点: 1. 快速. 2. 简单. 3. 多种缓存 ...
- arcgis,mapinfo(mapxtreme),openlayers专业GIS系统开发
专业从事基于C#,WinForm ,WPF,Silverlight,WCF以及MS Sql Server 2000/2005/2008/2012 Oracle 9i/10g/11g数据库系统的ERP, ...
- 好大滴坑, Spring MVC覆盖了Trsaction
好大滴坑. Spring MVC覆盖了Trsaction 解决方式: <!-- package-scan 4 Spring MVC --> <context:component-sc ...
- 移动开发 Native APP、Hybrid APP和Web APP介绍
高速区分定义: Native App 以基于智能手机本地操作系统如IOS.Android.WP并使用原生程式(SDK)编写执行的须要用户安装使用的第三方应用程序; Web APP 以HTML+JS+C ...
- dojo加载树错误
1.错误叙述性说明 error loading undefined children. TypeError:this._arrayOfTopLevelItems is undefied. ...
- Android通过意图使用内置的音频播放器
假设实现一个音频文件的播放,那么在应用程序中提供播放音频文件功能的最简单的方式是利用内置的"Music(音乐)"应用程序的功能--即使用系统自带的或已安装好的音乐播放器来播放指定的 ...
- 【安德鲁斯】于java代码集drawableLeft给予适当的大小如何,当?
textView.setCompoundDrawables(drawable, null, null, null);如果看不到图片,这是由于需要手动定drawable适当的大小,使用drawable. ...