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

123
Views
How to make dropdown expanded in desktop view but collapsed in mobile view?

Currently in all screen sizes by default, the dropdown is expanded and for that, I've used $('#id_name').toogleClass('open') for expanding and collapsing. But I need to make dropdown work expanded by default in desktop view but collapsed by default in mobile view.

Please help me with that anyone?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You can use window.innerHeight, let width = window.innerWidth.

   if (width <= 768) {
// you code for mobile view
}else{
  // your code for desktop view
}

768 == iPhone 10 width

about 4 years ago · Juan Pablo Isaza Report

0

   if (width <= 768) {
  $dropdown.slideUp();
}else{
  $dropdown.slidedown();
}

it will work for you.

about 4 years ago · Juan Pablo Isaza Report

0

You can use media queries in jss

`
//Create a condition that targets viewports at least 768px wide

constmediaQuery=window.matchMedia('(min-width: 768px)')

function handleTabletChange(e) { 
// Check if the media query is true 
if  (e.matches) { 
// Then toggle the class here
console.log('Media Query Matched!') } 
}
// Register event listener

mediaQuery.addListener(handleTabletChange) // Initial check
handleTabletChange(mediaQuery) `

about 4 years ago · Juan Pablo Isaza Report
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!