繁体   English   中英

尝试将徽标添加到 Shiny R 应用程序但未显示

[英]Trying to Add Logo To Shiny R App but not showing up

我在下面有以下代码,但我的徽标没有显示。 我将 PNG 保存在 www 文件夹中,但正如您在图像中看到的那样,它没有显示。 任何帮助将不胜感激。

ui <- 
  dashboardPage(
  dashboardHeader(
    title = img(src='logo.png', align = "right", height = 100, width = 200),
    titleWidth = 300
  ),

在此处输入图像描述

一种对我始终有效的方法是将公共存储库(即项目中的 github 存储库)中的图像加载到标头中:

ui <- 
dashboardPage(
#here replace "raw.githubusercontent.com/munoztd0/xaringan/master/logo_plain.png" with whatever public image you want
 header = list(
    tags$script(HTML("var header = $('.navbar > .container-fluid');
header.append('<div style=\"float:right\"><ahref=\"URL\"><img
src=\"https://raw.githubusercontent.com/munoztd0/xaringan/master/logo_plain.png\" alt=\"alt\" style=\"float:right;width:100px;height:41px;padding-top:10px;\"> </a></div>');
console.log(header)")),
    tags$script(HTML("var header = $('.navbar > .container-fluid');
header.append('<div style=\"float:right;height:30px;padding-right:50px;\"><h5></h5></div>');"))
  )
#change the css to change the size, position, padding ,etc..

暂无
暂无

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

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