Ask Your Question
1

How can one enable the use of position:sticky in shinydashboard with success?

asked 2023-07-02 14:33:24 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-02 14:59:01 +0000

qstack gravatar image

To enable the use of position:sticky in shinydashboard, you can follow these steps:

  1. Add the following CSS code to your app.css file:
/* Enable position:sticky */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 1030;
}
  1. Apply the sticky-top class to the element you want to make sticky. For example, if you want to make the dashboard header sticky, you can add the class to the header tag:
dashboardHeader(title = "My App", class = "sticky-top")
  1. Make sure the element has a fixed height. This is important because position:sticky requires an explicit height to work correctly. You can set a fixed height using CSS or by setting the height argument in the shinydashboard element.
dashboardHeader(title = "My App", class = "sticky-top", height = 60)

By following these steps, you should be able to enable the use of position:sticky in your shinydashboard app.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-02 14:33:24 +0000

Seen: 11 times

Last updated: Jul 02 '23