I'm using dragulaR to create draggable divs in Shiny, and added a tooltip using shinyBS to each div. I was wondering if it's possible to remove the tooltip (I tried adding jQuery
from JQuery UI: remove Bootstrap tooltip on a draggable clone when drag starts?) when dragging the div?
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)
by removing the title
text in the makeElement
function you'll be able to remove the "Hover" tooltip while dragging elements.
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"))
}