• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

147
Views
How to improve toggle menu with CSS and JavaScript?

I have implemented a functional menu of chapters(left) and Units(right) that works as i want and seen on the image i have attached. The problem is that it is slow, as i generate the CSS and JavaScript dynamically, so as to define the right ids for each element.

enter image description here

enter image description here

enter image description here

enter image description here

almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should get your data from the Database all at once:

What about doing this:

SELECT menuChapters.id, menuUnits.id
FROM menuChapters INNER JOIN menuUnits
ON (menuChapters.id = menuUnits.chapter_id)
WHERE menuChapters.class=$get_class AND menuChapters.course=$get_course AND menuChapters.visibility=1
ORDER BY menuChapters.chapterOrder ASC, menuUnits.unitsOrder ASC

This should give you a list where you have the id of your chapter and the id of your unit for each row.

I didn't try the code, so it might have some issues.

almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error