Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep vuetify element on top when scrolling

Tags:

vuetify.js

With Vuetify 2.0, I've got a layout with two cards - one on top of the other.

The bottom card is large so the user must scroll. I want the top card to stay in view (not be scrolled out of view), as it is used to display information about what I select in the bottom card.

enter image description here

like image 458
specimen Avatar asked Apr 30 '26 23:04

specimen


1 Answers

I don't know why this didn't work before, but creating a class like this, seems to do the trick:

.sticky {
   position: sticky;
   top: 0;
   z-index: 2;
}

Credit where it's due: This is where I found it

If anyone knows the "Vuetify way" of doing it, please share.

like image 138
specimen Avatar answered May 04 '26 01:05

specimen