-1

I am trying to set the property value of my pseudo element css class via javascript file.

The problem is that I am getting the error shown in the title.

Is there any other way to set it?

Code in css:

.list {
  display: flex;
  overflow-x: scroll !important;

  &:before {
    content: '';
    background: linear-gradient(90deg, transparent, white 10px);
  }
}

Code in typescript file:

  protected onScroll() {
    const scrollList = document.getElementById('list');
    const list: CSSStyleDeclaration = window.getComputedStyle(document.querySelector('.list'), ':before');
    if (list.scrollWidth - list.scrollLeft === list.offsetWidth) {
      list.setProperty('opacity', '0');
    } else {
      console.log("not set");
    }
  }

1 Answers

MA==
zXz{ZZ0yh¸z--Wnwo'(u*&^u+rܡע~^y&^u 'jrkyrh$~)^H^ir^+-O^ܨ"
(u