gpt4 book ai didi

javascript - shinyBS - 拖动时删除工具提示

转载 作者:行者123 更新时间:2023-12-02 22:28:35 25 4
gpt4 key购买 nike

我使用dragulaR在Shiny中创建可拖动的div,并使用shinyBS向每个div添加了一个工具提示。我想知道拖动 div 时是否可以删除工具提示(我尝试从 JQuery UI: remove Bootstrap tooltip on a draggable clone when drag starts? 添加 jQuery )?

library(shiny)
library(dragulaR)
library(shinyBS)

makeElement <- function(data, name)
{
div(style = "border-width:2px;border-style:solid;",
drag = name,
div(class = "active-title-row", id = name, name),
bsTooltip(id = name, title = "Hover",
placement = "top", trigger = "hover"))
}

ui <- fluidPage(

# Maybe something like this but it doesn't work
tags$script(HTML(
"$(function() {
start: function(event, ui) {
$('#bsTooltip').hide();
});"
)),

titlePanel("Drag and drop elements with dragulaR"),

fluidRow(style = "margin: 15px;",
column(3,
h3("Drag from here:"),
div(id = "Available", style = "min-height: 600px;",
lapply(colnames(mtcars), makeElement, data = mtcars))
),
column(3,
h3("Drop here:"),
div(id = "Model", style = "min-height: 600px;")
)
),
dragulaOutput("dragula")

)

server <- function(input, output) {

output$dragula <- renderDragula({
dragula(c("Available", "Model"))
})

}

shinyApp(ui = ui, server = server)

最佳答案

通过删除 makeElement 函数中的 title 文本,您将能够在拖动元素时删除“悬停”工具提示。

makeElement <- function(data, name)
{
div(style = "border-width:2px;border-style:solid;",
drag = name,
div(class = "active-title-row", id = name, name),
bsTooltip(id = name, title = "",
placement = "top", trigger = "hover"))
}

关于javascript - shinyBS - 拖动时删除工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58984412/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com