Jquery 按钮关闭、按钮最小化和按钮设置不能使用下面的javascript
使用下面的javascript,按钮关闭、按钮最小化和按钮设置不起作用 我使用boostrap 2.0.4Jquery 按钮关闭、按钮最小化和按钮设置不能使用下面的javascript,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,使用下面的javascript,按钮关闭、按钮最小化和按钮设置不起作用 我使用boostrap 2.0.4 //datatable $('.datatable').dataTable({ "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>", "sP
//datatable
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
$('.btn-close').click(function(e){
e.preventDefault();
if (e.target === this)
$(this).parent().parent().parent().fadeOut();
});
$('.btn-minimize').click(function(e){
e.preventDefault();
var $target = $(this).parent().parent().next('.box-content');
if($target.is(':visible')) $('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
else $('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
$target.slideToggle();
});
$('.btn-setting').click(function(e){
e.preventDefault();
$('#myModal').modal('show');
});
//数据表
$('.datatable').datatable({
“sDom”:“t”,
“sPaginationType”:“引导程序”,
“语言”:{
“sLengthMenu”:“\u MENU\u每页记录”
}
} );
$('.btn close')。单击(函数(e){
e、 预防默认值();
如果(例如,目标===此)
$(this.parent().parent().parent().fadeOut();
});
$('.btn最小化')。单击(函数(e){
e、 预防默认值();
var$target=$(this.parent().parent().next('.box content');
if($target.is(':visible'))$('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
else$('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
$target.slideToggle();
});
$('.btn设置')。单击(函数(e){
e、 预防默认值();
$('myModal').modal('show');
});
编辑1:我正在尝试使用此模板表
您可以在那里下载table.html文件。另一件我无法理解的事情是,当我检查html代码时,没有搜索文本输入,没有页面导航。它们是如何进入浏览器的
编辑2:我正在使用Google App Engine、Django、Jinja2如果您将
按钮
动态添加到DOM
,则单击()
可能无法工作
试试这个:
$(document).on("click", '.btn-close', function(e){
e.preventDefault();
if (e.target === this)
$(this).parent().parent().parent().fadeOut();
});
$(document).on("click", '.btn-minimize', function(e){
e.preventDefault();
var $target = $(this).parent().parent().next('.box-content');
if($target.is(':visible')) $('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
else $('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
$target.slideToggle();
});
$(document).on("click", '.btn-setting', function(e){
e.preventDefault();
$('#myModal').modal('show');
});
$('.datatable').datatable({
“sDom”:“t”,
“sPaginationType”:“引导程序”,
“语言”:{
“sLengthMenu”:“\u MENU\u每页记录”
}
} );
$('.btn close')。单击(函数(e){
e、 预防默认值();
$(this.parent().parent().parent().fadeOut();
});
$('.btn最小化')。单击(函数(e){
e、 预防默认值();
var$target=$(this.parent().parent().next('.box content');
如果($target.is(':visible'))
$('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
其他的
$('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
$target.slideToggle();
});
$('.btn设置')。单击(函数(e){
e、 预防默认值();
$('myModal').modal('show');
});
查看jqueryShare中的on()函数,分享相关的HTML代码。不工作不是一个很好的描述。你有什么错误吗?您面临的具体问题是什么?你能发布一个提琴吗?错误是当我点击这些按钮时,什么都没有发生。顺便问一下,我使用的是谷歌应用引擎,有没有任何问题,模板可能无法与GAE一起工作?你的按钮工作正常。你正在试用哪种浏览器?我正在使用Firefox18.0。我试过谷歌Chrome,但也没有试着拿出相关代码,创建一个示例应用程序来检查问题。
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
$('.btn-close').click(function(e){
e.preventDefault();
$(this).parent().parent().parent().fadeOut();
});
$('.btn-minimize').click(function(e){
e.preventDefault();
var $target = $(this).parent().parent().next('.box-content');
if($target.is(':visible'))
$('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
else
$('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
$target.slideToggle();
});
$('.btn-setting').click(function(e){
e.preventDefault();
$('#myModal').modal('show');
});