繁体   English   中英

在R Shiny标题中制作图像超链接

[英]Making an Image Hyperlink in R Shiny header

我一直在尝试将图像输出超链接到网站,但我在堆栈溢出时仔细考虑了其他问题

svg,闪烁的可点击链接 - 不可点击

http://www.invisiblecompany.com/shiny%20parts/archives/2004/11/clickable-logo.php

http://www.leahkalamakis.com/add-an-image-to-your-sidebar-make-it-clickable/

标签不起作用

server.r

library(shiny)
library(png)


server <- shinyServer(function(input, output) { 

output$image1 <- renderImage({
  width<- "100%"
  height<- "100%"
list(src = "www/logo.png",
     contentType = "image/png",
     width = width,
     height = height,
)

}, deleteFile = FALSE)
output$text1 <- renderText({ "please help make the image hyperlinked"     })


})

ui.r

library(shiny)



ui <- shinyUI(pageWithSidebar(
 titlePanel(imageOutput("image1")),

sidebarPanel(
  helpText(   a("Click Here for the Source Code on Github!",         href="https://github.com/Bohdan-Khomtchouk/Microscope",target="_blank"))

 ),
 mainPanel(
tabsetPanel(


  tabPanel("Instructions",textOutput("text1"))
))
))

你可以用你想要的任何东西替换logo.png我认为超链接在服务器的列表中。

只需在UI中使用tags$a包装imageOutput

titlePanel(tags$a(imageOutput("image1"),href="https://www.google.com"))

如果要从服务器端定义网页,则需要以下内容:

#server
  output$example <- renderUI({
    tags$a(imageOutput("image1"),href="https://www.google.com")
  })
#UI
titlePanel(uiOutput("example"))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM