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

161
Views
Changing a property of an if statement using media query

I am pretty new to javascript and I want to change the Margin-Top to 3vw instead of 1vw when the screen-size is smaller than 759px.

function myFunction() {
  var y = document.getElementById("color");
  var z = document.getElementById("color_text");
  

  if (y.style.opacity === "1") {
    y.style.opacity = "1";
    z.style.marginTop = "0vw";
    
  } else {
    y.style.opacity = "0";
    z.style.marginTop = "1vw";
    
  }
}
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!