Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Vue Videojs-markers customize markers background color without creating special class for each one

I’m using videojs-marker plugin to build a customized player that loads custom markers.

Each marker has a "type" that determines its color. I know that I can give a "class" attribute to each marker but the problem is that I have a lot of types and I do not want to create a separate CSS class for each type because it will be hard to maintain.

The code for creating the markers look something like this:

const markers = this.chapters.map(chapter => ({
  time: chapter.time / 1000,
  markersType: chapter.type,
  text: chapter.label,
  class: 'cue-style'
}));

cue-style CSS class looks like this:

/deep/ .cue-style {
  background-color: blue;
}

what I want is to alter the CSS class each time with a background-color based on chapter.label

is there any way to alter the default class of the marker instead of passing a new class each time?

something like:

const markers = this.chapters.map(chapter => ({
  time: chapter.time / 1000,
  markersType: chapter.type,
  text: chapter.label,
  markerStyle: {
    'background-color': 'red'
  },
}));
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!