bootstrap中常用的插件及示例
2015-09-01 11:21
459 查看
select2插件的使用
选择select2插件的使用$(id).select2({ data : data, minimumResultsForSearch : Infinity,// 禁用搜索 allowClear : true });
bootstrap-validator表单验证
使用bootstrap-validator插件reset重置表单
$('#btn-reset').click(function() { $('#changeForm').data('bootstrapValidator').resetForm(true); });
bootstrap-dialog页面加载、button
使用bootstrap-dialog插件function changePasswd(){
BootstrapDialog.show({
title : "修改密码",
message: function(dialog) {
var $message = $('<div></div>');
var pageToLoad = dialog.getData('pageToLoad');
$message.load(pageToLoad);
return $message;
},
data: {
'pageToLoad': 'changePasswd.html'
},
buttons: [{
id: 'btn-ok',
icon: 'glyphicon glyphicon-check',
label: 'OK',
cssClass: 'btn-success',
autospin: false,
action: function(dialogItself){
change();
dialogItself.close();
}
}, {
id:'btn-reset',
cssClass: 'btn-warning',
label: '重置',
icon: 'glyphicon glyphicon-repeat',
action : function(){
document.getElementById("changeForm").reset();
$('#btn-reset').click(function() { $('#changeForm').data('bootstrapValidator').resetForm(true); });}
}, {
id:'btn-close',
icon:'glyphicon glyphicon-remove',
label: 'Close',
cssClass: 'btn-danger',
action: function(dialogItself){
dialogItself.close();
}
}]
});
}
Jquery-confirm 插件之alert使用
使用 Jquery-confirm.js插件function alertView(str){ $.alert({ animation : 'zoom', animationBounce : 2, keyboardEnabled : true, title : false, content : str, theme : 'white', }); }
Jquery-confirm 插件之confirm使用
使用 Jquery-confirm.js插件$.confirm({ title: '退出系统登陆吗?', content : false, // autoClose: 'confirm|10000', confirmButtonClass : 'btn-info', cancelButtonClass : 'btn-danger', confirm : function() { $.ajax({ type : "post", url : "logoutAction.action", async: false, success :function(){ location.href = "../login.jsp"; } }); }, cancel : function() { alert('canceled'); } });
bootstrap Table
bootstrap Table更新操作$table.bootstrapTable('updateRow', { index : index1, row : { tid : tid, cid : cid, uid : uid, date : date, type : type, } });
添加操作
使用bootstrap table插件
table rowStyle和runningFormatter
<table data-row-style="rowStyle"> <thead> <tr><th data-align="center" data-formatter="runningFormatter">ID</th> </tr></thead>
function rowStyle(row, index) { /*var classes = ['active', 'success', 'info', 'warning', 'danger'];*/ var classes = ['success', 'info', 'warning', 'danger']; /*if (index % 2 === 0 && index / 2 < classes.length) { return { classes: classes[index / 2] }; }*/ if(index % 2 ===0){ return { classes:classes[index%3] } } return {}; } function runningFormatter(value, row, index) { return index+1; }
tablet添加操作
<th data-field="operate" data-formatter="operateFormatter" data-events="operateEvents" data-align="center">操作</th>
bootstrap model远程加载示例
<a id="adduser" class="btn btn-danger" data-toggle="modal" href="addUser.html" data-target="#adduserModal">添加</a> <div class="modal fade" id="adduserModal" role="dialog" aria-labelledby="myModalLabel" data-keyboard="true"> <div class="modal-dialog" role="document"> <div class="modal-content"></div> </div> </div>
table表中修改某一条记录时,model弹出框获取记录值
function editTerminal(row,index) { index1=index; $('#editTerminalModal').on('show.bs.modal',function(event) { var button = $(event.relatedTarget); var recipient = button.data('whatever'); var modal = $(this); modal.find('.modal-title').text(recipient); modal.find('#tid').val(row.tid); modal.find('#type').val(row.type); modal.find('#cid').val(row.cid); modal.find('#uid').val(row.uid); modal.find('#date').val(row.date); }) }
相关文章推荐
- bootstrap初试进度条
- Bootstrap 3.3.4 发布,Web 前端 UI 框架
- java自动生成验证码插件-kaptcha
- jQuery菜单插件用法实例
- 加载flash9.ocx出现错误的解决方法
- jquery实现的代替传统checkbox样式插件
- 10款新鲜出炉的 jQuery 插件(Ajax 插件,有幻灯片、图片画廊、菜单等)
- 推荐40个非常优秀的jQuery插件和教程【系列三】
- Node.js插件的正确编写方式
- 推荐十款免费 WordPress 插件
- 使用JavaScript开发IE浏览器本地插件实例
- 推荐25个超炫的jQuery网格插件
- 纯JavaScript实现的分页插件实例
- JQuery插件jcarousellite的参数中文说明
- 基于Bootstrap的网页设计实例
- 精彩的Bootstrap案例分享 重点在注释!(选项卡、栅格布局)
- jQuery插件kinMaxShow扩展效果用法实例
- jQuery插件制作之全局函数用法实例
- 精心收集的jQuery常用的插件1000
- 40款非常棒的jQuery 插件和制作教程(系列二)