猿问

shinyBS - 拖动时删除工具提示

我正在使用 dragulaR 在 Shiny 中创建可拖动的 div,并使用 shinyBS 向每个 div 添加了一个工具提示。我想知道是否可以在拖动 div 时删除工具提示(我尝试jQuery从JQuery UI添加:在拖动开始时删除可拖动克隆上的 Bootstrap 工具提示?)?


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)


繁星coding
浏览 119回答 1
1回答

有只小跳蛙

通过删除函数中的title文本,makeElement您将能够在拖动元素时删除“悬停”工具提示。makeElement <- function(data, name){&nbsp; div(style = "border-width:2px;border-style:solid;",&nbsp; &nbsp; &nbsp; drag = name,&nbsp; &nbsp; &nbsp; div(class = "active-title-row", id = name, name),&nbsp; &nbsp; &nbsp; bsTooltip(id = name, title = "",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; placement = "top", trigger = "hover"))}
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答