Bootstrap .popover('show'),. popover('hide')不起作用。将其绑定到单击工作 [英] Bootstrap .popover('show'), .popover('hide') not working. Binding it to click works
问题描述
我有一个已绑定到弹出窗口的按钮。当有人点击popover中的一个表情符号时,我想隐藏popover。但是, $(#smiley)。popover('hide')
不起作用。
不幸的是我无法使用准系统代码重现这一点 - 它只发生在现场网站上,即 https://coinchat.org
相关代码:
$(#smiley ).popover({html:true,trigger:'click',placement:'top',content:smileyContent,title:'Smilies'});
稍后在函数中..
$( #笑脸)酥料饼( '隐藏')。 //不工作
在 https://inputs.io/js/buttons.js jQuery插件 jQuery.fn.popover
会在某种加载事件上被覆盖,所以 $(#smiley)。popover(hide)
此时为no更长时间调用bootstrap,但是 inputs.io
提供的插件。
代码片段:
Inputsio.load = function(){
(function(){(function(e){return e.fn.popover = function(t)
对于特定于应用程序的代码使用jQuery插件名称空间确实非常令人反感。 / p>
临时修复可能是 $(#smiley)。click()
I have a button that has been binded to a popover. I would like to hide the popover when someone clicks on one of the smilies in the popover. However, $("#smiley").popover('hide')
does not work.
Unfortunately I haven't been able to reproduce this with barebones code - it only happens on the live site, which is https://coinchat.org
Relevant code:
$("#smiley").popover({html: true, trigger: 'click', placement: 'top', content: smileyContent, title: 'Smilies'});
Later in a function..
$("#smiley").popover('hide'); // not working
In https://inputs.io/js/buttons.js the jQuery plugin jQuery.fn.popover
is overwritten on a load event of some kind, so $("#smiley").popover("hide")
at that point is no longer calling into bootstrap but the plugin provided by inputs.io
.
A snippet of the code:
Inputsio.load = function(){
(function(){(function(e){return e.fn.popover=function(t)
The usage of jQuery plugin namespace for application specific code is extremely distasteful indeed.
A temporary fix could be $("#smiley").click()
这篇关于Bootstrap .popover('show'),. popover('hide')不起作用。将其绑定到单击工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!