0

In my portfolio project there are some common html code snippet on about, projects, contact.html pages like navbar,footer and sidebar. The main app.js file contains toggling sidebar functionality, mouseover event on menus to open submenu, hint text on icon hover etc How to add these functionality on every html pages.

We link app.js to every html pages, but there were showing various error like various element undefined since app.js has more code and element selection.

1
  • Extract the related code of toggling in one common js file and include that on all the required files. Commented Mar 26, 2023 at 18:25

1 Answer 1

0

To avoid "hardcoding". Make Web Components out of your developments. Isolation and reuse is our everything :)

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.