• danielm04

    (@danielm04)


    I want to change the background of a specific element, this is the code i have:

    .overlay .playWrapper {
      opacity: 0;
      position: absolute; z-index: 1;
      top: 0;
      width: 193px; height: 193px;
        background: rgba(0,0,0,0.6) url("myimg") no-repeat scroll center center / 60px 60px;

    but because i have 2 class elements when i use document.getElementByClass it doesn’t work and i need it to me inside a function, since i want the background to deppend on the condition. Anyone can help with this?

    • This topic was modified 5 years, 11 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Joy

    (@joyously)

    What is the if statement about? Is this a player for videos or something?
    If you are doing this in Javascript, it doesn’t matter what your CSS has. And you can use any kind of selector, not just one class, if you use querySelector instead of getElementByClass.
    https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector

    Thread Starter danielm04

    (@danielm04)

    Yes, it is for a video, and I want the play button to toggle to pause when it is playing, but that button is defined in my background in those css scripts

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Change background on if statement’ is closed to new replies.