我目前正在尝试从一个数据框为一个爱好 Shiny 应用程序创建一个“墙”的卡片。改编自这个SO answer,这是我的代码的最小完整示例:
library(shiny)
df <- read.csv("https://github.com/intelligence-refinery/shiny_app/raw/master/flyer.csv")
card <- function(img, item, store) {
HTML(
paste0(
'<div class="card">
<div class="container">
<h4><b>', item, '</b></h4>
</div>
<img src="', img, '" style="width:100%">
<div class="container">
<h5><i>', store, '</i></h5>
</div>
</div>'
)
)
}
ui <- fluidPage(
tags$head(tags$style('.card {
width: 250px;
clear: both;
/* Add shadows to create the "card" effect */
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
}
/* On mouse-over, add a deeper shadow */
.card:hover {
box-shadow: 0 …Run Code Online (Sandbox Code Playgroud)