gpt4 book ai didi

css - R Shiny-CSS react 消息

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

我使用 Shiny 有一段时间了,最​​近开始使用 CSS 自定义我的应用程序,这非常棒。当指针经过特定元素时,我设法显示一个消息框,但现在我想显示一个变量。例如在下面的应用程序中,当鼠标移到 slider 按钮上时,在消息框内我想计算 slider 值,即“input$test”:

#### ui.R

shinyUI(fluidPage(
tags$head(tags$style(HTML('

.irs.js-irs-0.irs-with-grid .irs-slider.single:hover:after {
content: "SLIDER VALUE HERE";
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
left: 20%;
padding: 5px 15px;
position: absolute;
width: 220px;
text-align: center;
}

'))),

sliderInput("test", "TEST:",
min=0, max=1000, value=500)
))

#### server.R

library(shiny)
shinyServer(function(input, output) {
})

感谢您的帮助。

最佳答案

这很有效,希望它能帮助其他人:

#### ui.R

shinyUI(fluidPage(


uiOutput("htmltest"),

sliderInput("test", "TEST:",
min=0, max=1000, value=500)

))

#### server.R

shinyServer(function(input, output) {


output$htmltest <- renderUI({
txtx=paste('.irs.js-irs-0.irs-with-grid .irs-slider.single:hover:after {
content: "',input$test,'";
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
left: 20%;
padding: 5px 15px;
position: absolute;
width: 220px;
text-align: center;
}',sep="")

tags$head(tags$style(HTML(txtx)))
})

})

关于css - R Shiny-CSS react 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35652842/

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