Javascript R:选择输入项目始终在固定面板顶部滚动
我有一个R Shining文件,通过fixedPanel()在页面顶部包含一个横幅。它还有一个侧边栏,其中包含一个用selectInput()创建的菜单。当我向上滚动页面时,selectInput菜单是唯一在横幅顶部滚动的UI项。在包含fixedpanel之前,我曾尝试将边栏和selectInput项放在absolutePanel中,认为这可能会导致它们位于较低的“层”,但这并不能阻止这种行为。下面是产生这种行为的代码。请注意,我添加了一个1600像素的空白图像,只是为了有一些东西可以滚动,我没有包括任何其他UI项目(但它们会在fixedPanel下滚动)。以下是app.R文件:Javascript R:选择输入项目始终在固定面板顶部滚动,javascript,r,shiny,Javascript,R,Shiny,我有一个R Shining文件,通过fixedPanel()在页面顶部包含一个横幅。它还有一个侧边栏,其中包含一个用selectInput()创建的菜单。当我向上滚动页面时,selectInput菜单是唯一在横幅顶部滚动的UI项。在包含fixedpanel之前,我曾尝试将边栏和selectInput项放在absolutePanel中,认为这可能会导致它们位于较低的“层”,但这并不能阻止这种行为。下面是产生这种行为的代码。请注意,我添加了一个1600像素的空白图像,只是为了有一些东西可以滚动,我没
library(shiny)
shinyApp(
ui <- shinyUI(
fluidPage(
absolutePanel(0, 0, width="100%", height="100%",
# Leave a gap for the fixed panel containing the RAFT banner at the top of the page.
fluidRow(
img(src="", height=110)
),
fluidRow(
sidebarPanel(
# Insert a menu.
selectInput(
inputId="select",
label="Select:",
choices=1:4
),
img(src="", height=1600)
)
)
),
# Insert a fixed panel containing the banner at the top of the page.
fixedPanel(top="0%", height="60", left="0%", width="100%",
img(src="banner.jpg", height=90, width=600)
)
)
),
server <- shinyServer(function(input, output, session) {
})
)
库(闪亮)
shinyApp(
ui在没有得到任何响应后,我开始挖掘支持shiny软件包的CSS和JS文件。我将shiny R代码转换为HTML,并开始了一个先删除文件,然后删除文件中的行的尝试和错误过程,我发现在文件selectize-bootstrap3.CSS中,类选择器。selectize input
被定义为具有z-index
的1。这显然足够高,使其浮动在我创建用作横幅的fixedPanel元素上方。解决方案是为fixedPanel提供更高的z-index,因此我替换了此代码:
fixedPanel(top="0%", height="60", left="0%", width="100%",
img(src="banner.jpg", height=90, width=600)
)
fixedPanel(style="z-index:100;",
top="0%", height="60", left="0%", width="100%",
img(src="banner.jpg", height=90, width=600)
)
使用此代码:
fixedPanel(top="0%", height="60", left="0%", width="100%",
img(src="banner.jpg", height=90, width=600)
)
fixedPanel(style="z-index:100;",
top="0%", height="60", left="0%", width="100%",
img(src="banner.jpg", height=90, width=600)
)
这就解决了问题