sách gpt4 ai đã đi

Công cụ chú giải Bootstrap 3 hoạt động kỳ lạ khi kích hoạt là 'nhấp', không hoạt động khi kích hoạt là 'thủ công'

In lại 作者:行者123 更新时间:2023-12-03 11:17:03 30 4
mua khóa gpt4 Nike

我快疯了,我试图理解工具提示的行为,但没有成功。

1. 第一个问题是当我尝试通过插件(按钮 1)在点击事件中使用它时 -> 如果您转到 Fiddle,您会在“内容”内看到该函数' 每次点击都会调用该属性两次...为什么?

2. 我想使用绑定(bind)到元素(按钮 2)的工具提示并以Thủ công模式显示它,但它根本不起作用...为什么?

HTML


JS

 var i = 0, j = 0; 

$('.container').popover({
selector: '.btn-success',
html: true,
placement: 'right',
container: '.container',
trigger: 'click',
content: function(){
$('.badge.b0').text(j++);
return 'test';
}
});

$('.container').popover({
selector: '.btn-danger',
html: true,
placement: 'right',
container: '.container',
trigger: 'manual',
content: 'test'
});

$('.container').on('click', '.btn-danger', function(){
$('.badge.b1').text(i++);
$(this).popover('show');
});

FIDDLE

1 Câu trả lời

http://jsfiddle.net/gepbmonh/8/

$('#add').click(function () {
addButton()
})

var ind = 0;
// adding buttons
function addButton() {
ind++;
// creating button
$button = $('');
$button.text('I\'m not working! :-( ' + ind);
$button.addClass('btn btn-danger has_popover');
$button.attr('data-html', 'true');
$button.attr('data-placement', 'left');
$button.attr('data-trigger', 'manual');
$button.attr('data-content', 'test ' + ind);
// creating badge
$span = $('0');

$wrap = $('
');
$wrap.append($button).append($span);

// add to the stage
$('#buttons').append($wrap);
}
//inclick event
$('.container').on('click', '.has_popover', function () {
// find an appropriately badge
$badge = $(this).parent().find('.badge');
// get current value
var i = $badge.text();
i = parseInt(i);
// increase for one
i++;
$badge.text(i);
//showing popover
$(this).popover('show');
});

关于javascript - 当触发器为 'click' 时,Bootstrap 3 工具提示表现得很奇怪,当触发器为 'manual' 时,则不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27295558/

30 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com