Skip to content

Sticky sidebar #217

Answered by crftwrk
KatyPurry asked this question in Q&A
Aug 14, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi,

at first to not affect the mobile offcanvas, simply use media queries in _bscore_custom.scss. In your case breakpoint is lg:

@media (min-width: 992px) {
  // Do stuff here
}

Thanks to Sass we can use mixins instead:

@include media-breakpoint-up(lg) {
  // Do stuff here
}

As you mentioned, this works fine if you make the whole #secondary sidebar sticky:

@include media-breakpoint-up(lg) {
  #secondary {
    position: sticky;
    top: 50px;
  }
}

If you want to stick just a part of the sidebar, then you must give element enough space to be sticky by adding 100% height to it's parent elements and reset card-body flex. This should be do the trick:

@include media-breakpoint-up(lg) {

  #sec…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@KatyPurry
Comment options

@crftwrk
Comment options

Answer selected by KatyPurry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants