仅每秒显示一次来自ShiningBS的闪亮弹出框 [英] Shiny popover from shinyBS displays every second time only
本文介绍了仅每秒显示一次来自ShiningBS的闪亮弹出框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
shinyBS的动态弹出窗口仅在第二选择时打开.
The dynamic popover from shinyBS only turns up on every second selection.
library(shiny)
library(shinyBS)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("poppy", "Think!", c("A", "B", "C", "D")),
bsButton("dummy", "dummy")), ## required, dummy
mainPanel(
helpText("Note that when you select from the box, popover turns up every second time only!")
)))
server <- function(input, output, session) {
observe({
poppy = paste("You selected ", input$poppy)
addPopover(session, "poppy", "Every second time", poppy)
})}
shinyApp(ui = ui, server = server)
推荐答案
这是Bootstrap中的一个已知错误:
This is a known bug in Bootstrap:
Bootstrap popover destroy&重新创建作品每隔第二次
如果您不想更改ShinyBS的代码,请在www子文件夹中添加一个包含以下内容的js文件:
If you do not want to change the code of ShinyBS, add a js file with the following in your www subfolder:
shinyBS.addTooltip = function(id, type, opts) {
var $id = shinyBS.getTooltipTarget(id);
var dopts = {html: true};
opts = $.extend(opts, dopts);
if(type == "tooltip") {
$id.tooltip("destroy");
setTimeout(function() {$id.tooltip(opts);},200);
} else if(type == "popover") {
$id.popover("destroy");
setTimeout(function() {$id.popover(opts);},200);
}
}
并将以下内容添加到您的ui :(假设文件名为pop_patch.js)
and add the following to your ui: (assuming the file is named pop_patch.js)
singleton(tags$head(tags$script(src = "pop_patch.js"))),
这篇关于仅每秒显示一次来自ShiningBS的闪亮弹出框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文