Enable synchronized scrolling and a fixed/sticky header with splitpanes feature

Sandbox.vue

<template>
  <v-container fluid>
    <Splitpanes
      class="default-theme"
      style="height: 400px"
    >
      <Pane
        v-for="i in 2"
        :key="i"
      >
        <div class="pa-4">
          <div>Header</div>
          <div>
            <!-- long text... -->
          </div>
        </div>
      </Pane>
    </Splitpanes>
  </v-container>
</template>

<script>
import { Splitpanes, Pane } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css'

export default {
  components: {
    Splitpanes,
    Pane
  }
}
</script>

<style scoped>
.splitpanes__pane {
  overflow-y: auto;
}
</style>

https://i.sstatic.net/yA9VG.png

How can I achieve synchronized scrolling (scrolling left and right) and a fixed header for this layout?

Edit #1

This is how I achieved synchronized scrolling:

<template>
  <v-container fluid>
    <v-card
      class="overflow-y-auto"
      height="400"
      outlined
      flat
    >
      <Splitpanes
        class="default-theme"
        style="height: auto"
      >
        <Pane min-size="1">
          <div class="sticky">
            Header
          </div>
          <div class="pa-4">
            <!-- Long text... -->
          </div>
        </Pane>
        <Pane min-size="1">
          <div class="sticky">
            Header
          </div>
          <div class="pa-4">
            <!-- Long text... -->
          </div>
        </Pane>
      </Splitpanes>
    </v-card>
  </v-container>
</template>

<script>
import { Splitpanes, Pane } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css'

export default {
  components: {
    Splitpanes,
    Pane
  }
}
</script>

<style>
.splitpanes.default-theme .splitpanes__pane {
  background: transparent;
}
.default-theme.splitpanes--vertical > .splitpanes__splitter {
  border-left: none;
}
.default-theme.splitpanes--vertical > .splitpanes__splitter::before,
.default-theme.splitpanes--vertical > .splitpanes__splitter::after {
  height: 100%;
}
.sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
}
</style>

I tried creating a sticky class for the header but it doesn't seem to work. Any suggestions on achieving this?

Answer №1

After exploring the available projects listed here: https://github.com/vuejs/awesome-vue#scroll, it appears that vue-scroll-sync is attempting to achieve the desired functionality.


UPDATE: Despite several attempts, I was unable to successfully make it work...

This is as far as I got without any luck

<template>
  <div style="display: flex">
    <scroll-sync :vertical="true">
      <div
        style="width: 100px; height: 600px; overflow: auto; background: teal"
      >
        // Content omitted for brevity
      </div>
    </scroll-sync>
    <scroll-sync :vertical="true">
      <div style="width: 100px; height: 300px; overflow: auto; background: red">
        // Content omitted for brevity
      </div>
    </scroll-sync>
  </div>
</template>

<script>
export default {
  components: {
    [process.client && 'ScrollSync']: () => import('vue-scroll-sync'),
  },
}
</script>

Since the maintainer lacks additional information, contacting them more effectively seems challenging.


TLDR: It seems manual implementation may be the only viable option at this point.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Vue and vue-multiselect to create interactive options based on the selected language

I'm currently developing a Vue website with multilingual support. The chosen language is stored in a Vuex store and accessed through the computed property lang, like so: lang(){ return this.$store.state.lang } I use this lang property in v-if cond ...

Introducing the new and improved SweetAlert 2.0, the ultimate solution for

I am currently utilizing SweetAlert2.0, known as "This One" <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> It is functioning properly; however, I would like to display a table, div, or HTML element within this swe ...

My webpage layout doesn't quite accommodate my content, so I need to adjust it to be more zoom

Why does the page container load bigger than the html/body container in mobile mode, as shown in the photo? https://i.sstatic.net/fD1N4.png Here is my CSS: html { margin-top: 48px; width: 100%; } body { margin: 0; width: 100%; background: ...

Adjust the parent div's background when hovering over it

Here is the code snippet I am working with: <div class="thumb_image_holder_orange"> <img src="http://dummyimage.com/114x64/000/fff.png" /> </div> I want to change the background of the div when hovering over the image, rather than j ...

Continuous loop of images displayed in a slideshow (HTML/JavaScript)

Greetings everyone, I am currently working on creating an endless loop slideshow of images for my website. Despite researching several resources, I am still struggling to get the code right. The issue I am facing is that only the image set in the HTML code ...

Issues with Laravel 5.8 and Bootstrap not functioning properly in Jquery

Check out this link for using Bootstrap Select. The code works perfectly in the view, but when I try to implement it with jQuery below, it doesn't work. Can someone help me fix this issue? View Code: <table id="tableAppointment" style=&q ...

Using Vue.js to share events and data across various components

I am currently working on an application that features a Google map with a places autocomplete controller, similar to the example provided by Google at this link. Whenever an address is searched or selected, or when the map bounds are changed, I trigger a ...

how to dynamically update page titles based on route links in Vue.js

Is there a way to dynamically change the page title in Vue.js based on the links followed, similar to how every page on Stack Overflow has unique titles reflecting different questions? Some titles are even linked to the question itself. This kind of func ...

Can CSS be used to dynamically change the color of an element based on a specific value?

Is it possible to dynamically change the background color of table cells using only CSS based on their values? For example, I am looking to achieve a similar effect as in Excel with conditionally formatted values: https://i.stack.imgur.com/6BsLB.png If ...

Having trouble with the visibility of the hover background?

I have a goal in mind: This is the outcome I've achieved so far: LINK My aim is to have a white background with a blue border appear at the bottom when hovering over navigation links. Unfortunately, this isn't happening as expected. Can anyone ...

Creating Sleek Rounded Corners with Pure CSS in Older Versions of Internet Explorer (Compatible with jQuery)

Looking for a seamless solution to render rounded corners on browsers that do not support CSS3 without the delay typically seen with JQuery plugins. The use of .htc files with www.css3pie.com seems like the best option so far, but there is still a delay c ...

Is it possible to apply styles to javascript elements without relying on img class? Additionally, how can I incorporate an onclick button while maintaining a fully functional navigation bar?

My current project involves creating an interactive collage where users can click around and have pictures pop up at the clicked location. The functionality works as intended, but now I'm facing issues with the navigation bar not being clickable. Addi ...

Adjusting the text color for select values within a <td> element

I have a table that is populated with data retrieved from an API. Each cell in the table contains multiple pieces of data. Below is the code used to create the table: <td class="myclass"> <?php $myvar = explode(" ", $json["data"]); ...

Utilizing personalized CSS for specific ioslides

If I decide to stick with the default data and presentation of a new ioslides, changing only the second slide (## R Markdown) without affecting the entire item, how can I do this by setting up the css document accordingly? My goal is to simply adjust the f ...

Experimenting with animating an element through onClick event using JavaScript

I would like to create an animated div using JavaScript that activates on click. <div class="Designs"> <p>Designs</p> <div class="Thumbnails" data-animation="animated pulse"> <a href=" ...

Using the <hr> tag in HTML to create a horizontal line is proving to be a challenge for me

.yellow-line{ position: absolute; top: 60px; overflow: auto; border: 10px solid red; } <img class="vox-logo" src="images/vox_logo.JPG" alt="Vox Logo"> <div class="header"> <h5 class="menu-0">EXPLAINERS</h5> ...

Rendering SVG graphics on browsers for Android devices

I've been struggling with an issue for quite some time now and I can't seem to find a solution. The problem lies in having an SVG image as a CSS background on the top left corner of a div. Instead of seamlessly merging with the div background, i ...

The CSS in Django seems to be malfunctioning on various pages, particularly on header elements

My CSS file is linked in 'main/static/css/style.css' and my pages are located in 'main/templates/main/pages.html'. However, the CSS does not seem to be working properly for some pages; for example, the h2 tag is not taking on the specif ...

In bootstrap 3.0, columns are arranged in a vertical stack only

As a newcomer to web design, I've been struggling to figure out why my basic grid in Bootstrap 3 isn't working as expected. No matter what I try, my columns stack vertically instead of side by side and always resize to fill the browser window. Th ...

The behavior of Material-UI Drawer varies when used on tablets

Encountering some strange issues with the Material-UI drawer component. It's scrolling horizontally on my iPad, while it scrolls vertically on my MacBook and Android Phone. Expected Result on MacBook: https://i.sstatic.net/txBDf.png On my MacBook, it ...