推特引导:Popop不会在第一次点击时出现,但会在第二次点击时显示
Twitter bootstrap:Popop are not showing up on first click but show up on second click
这是我的代码。请帮我
$(document).ready(function(){
$(document).delegate(".view","click",function(){
var id = $(this).attr("id");
alert(id);
$("#"+id).popover({
html : true,
content: function() {
return $("#"+id+"tt").html();
},
title: function() {
return $('#popoverTitle').html();
}
});
alert("thisa");
});
});
尝试将函数.delete()替换为.on(),此函数在Jquery的最新版本中已被取代。
jQuery 1.4.3+
$( elements ).delegate( selector, events, data, handler );
jQuery 1.7+
$( elements ).on( events, selector, data, handler );
代码是:
$(document).ready(function(){
$(document).on("click",".view",function(){
var id = $(this).attr("id");
alert(id);
$("#"+id).popover({
html : true,
content: function() {
return $("#"+id+"tt").html();
},
title: function() {
return $('#popoverTitle').html();
}
});
alert("thisa");
});
});
尝试这样做。。
$('.view')
.popover({trigger: 'manual'})
.click(function() {
if($(this).hasClass('pop')) {
$(this)
.popover('hide')
.removeClass('pop');
} else {
var id = $(this).attr("id");
var title = $('#popoverTitle').html();
var response = $("#"+id+"tt").html();
$(this)
.attr({'title': title, 'data-content': response})
.popover('show')
.addClass('pop');
}
});
相关文章:
- 推特引导:弹出窗口不会在第一次点击时出现,但会在第二次点击时显示
- 拖动效果不会第二次显示
- 如何在访问者第二次单击链接时显示不同的页面
- 如何在第一次点击时突出显示链接;并在第二次单击时跟随它,除非在其他地方单击,然后重新初始化未高亮显示的状态
- AngularJS 在第二次渲染时显示大括号
- 日期选择器 getDate 方法在第二次单击时工作并显示上一个选定的日期
- Ajax 对对话框窗口的响应在第二次尝试时不显示更改的值
- 当我第二次运行我的应用程序时,结果没有显示
- jQuery UI 对话框 - 第二次显示未选择的文本
- 奇怪的是,在第二次单击切换隐藏/显示按钮而不是第一次单击后,有两行有效
- 显示/隐藏脚本无法在第二次单击时再次隐藏
- 当我第二次单击链接时如何显示面板
- Marionette没有't在第二次显示父视图时渲染子视图
- Parsejs angular/ionic在视图中检索关系对象(第二次打开页面时显示值)
- 工具提示显示在第二次悬停之后
- BrowserSync显示第二次刷新后的更改
- AngularJS-第一次运行.service计划发送数据,但没有显示,第二次运行,没有发送数据的计划,但显示了一些
- 在javaScript中第二次单击按钮时显示警报
- 希望在第二次通过间隔后逐个显示数字
- 为什么弹出没有显示第二次在传单标记