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

168
Views
How can I reveal my site's sub-menu for mobile?

I am trying to reveal my sub-menu using jQuery. It is a rewrite of the code in the image using jQuery.

https://github.com/alwayswantedtocode/xpress-cars-web-dev-

Code I am trying to rewrite using jQuery:

code I am trying to rewrite using jquery

$(document).on("click", ".navigation", function(event) {

  const target = $(event.target),
    mediaSize = 991;
  homeSubList = $(event.target.parentElement),
    revealSubMenu = $(homeSubList).add('.sub-menu');

  if ($(target).attr("data-toggle") && (window.innerWidth <= mediaSize)) {
    $(homeSubList).toggleClass("active");

    $(revealSubMenu.height()) = $(revealSubMenu).prop('scrollHeight') + 'px';
  };
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here it is:

$(document).on("click",".navigation", function(event){
  const mediaSize = 991;
  if ($(event.target).attr('data-toggle') !== undefined && window.innerWidth <= mediaSize) {
    const menuItemHasChildren = $(event.target).parent();

    $(menuItemHasChildren).addClass('active');
    const subMenu = $(menuItemHasChildren).find('.sub-menu');
    $(subMenu).css('maxHeight', $(subMenu).prop('scrollHeight'));
  }
});
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!