html - R Shiny withProgress Indicator Within Fluid Container

标签 html css r shiny

我正在设计一个应用程序,我有一个 withProgress() 通知,它在整个过程中被大量使用。我用类似的东西设置了酒吧的位置:

tags$style(
  paste0(
    ".shiny-progress-notification{",
    "  position:fixed !important;",
    "  top: calc(0.5%) !important;",
    "  left: calc(9%) !important;",
    "  font-size: 15px !important;",
    "  font-style: bold !important;",
    "  width: 500px !important;",
    "}"
  )
)

这样做的问题在于,它会根据用户的显示器以及放大的程度等显示在不同的位置。

是否可以将加载对象放置在流体对象或类似对象中,以便它以更结构化的方式适合页面,并且我不必显式或使用 calc() 定义坐标?

具体来说,我想将加载栏放在页面顶部的 fluidRow() 中,这样它就属于同一 mainPanel() 和其他一切一样。我知道这个问题有点宽泛,但我愿意接受任何使加载栏相对于所有流体对象保持在适当位置的答案。

原始 html 看起来像这样:

<!DOCTYPE html>
<html class = "shiny busy">
  <head>...</head>
  <body>
    <div class="container-fluid">...</div>
    <div id="shiny-notification-panel">
      <div id="shiny-notification-f2530c977659e1a3" class="shiny-notification">
        <div class="shiny-notification-close">×</div>
        <div class="shiny-notification-content">
          <div class="shiny-notification-content-text">
            <div id="shiny-progress-f2530c977659e1a3" class="shiny-progress-notification">
              <div class="progress progress-striped active" style="">
                <div class="progress-bar" style="width: 30%;"></div>
              </div>
              <div class="progress-text">
                <span class="progress-message">Instantiating Data</span>
                <span class="progress-detail"></span>
              </div>
            </div>
          </div>
          <div class="shiny-notification-content-action"></div>
        </div>
      </div>
    </div>
  </body>
</html>

所以在这种情况下,我希望 shiny-progress-notificationcontainer-fluid 协调移动。

最佳答案

如果您希望加载栏始终位于任何流体容器的顶部,那么您可以这样做:

<div class="container-fluid">
 <div id="shiny-notification-panel"></div>
</div>

并应用以下样式:

.container-fluid{
  position: relative;
}

#shiny-notification-panel{
  position: absolute;
  // setting this tells the panel to occupy the parent's width and to always be on top
  top: 0;
  left: 0;
  right: 0;
  height: 10px; // just sets the height
}

这样做的目的是让 Shiny 的面板始终相对于流体容器的位置,并且始终位于顶部。

关于html - R Shiny withProgress Indicator Within Fluid Container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50356842/

相关文章:

javascript - 使用 Ajax 更改 div 的内部内容

jquery - 悬停时更改表格行背景颜色

css - 如何在 HTML 中的卡片中添加图片?

r - R填充向量

r - 查找目标数字之间所有数字的最快方法

javascript - 输入的焦点不会通过代码消失

html - 带边框的圆看起来不圆,锯齿状,不光滑,为什么?

jquery - css - 在内容上方 float 页眉和页脚,使用 jquery 自动调整背景大小

html - 带有后元素的自定义复选框 - 不能可靠地居中

r - 如何使用 R 为大量 IP 生成国家/地区名称?