Skip to content

Tag: html

open/close sidebar changing buttons

it says me -> Uncaught TypeError: document.getElementById(…) is null Answer document.getElementById does not target a node by its class=”” but by its id=”” To target an element by its class you can use document.querySelector

Binding touch and scroll to wheel event

I have this code for vehicle to horizontal and back to vertical scrolling, however it only works on mouse wheel scroll. I also need it to respond accordingly to mobile touch, scrollbars, page up/down, and the keyboard arrow keys. Below is my code: How can I make this work for mobile touch, scroll bar, arrow k…

Change active class when a menu item is clicked

I’m trying to change the active class when I click one of the items in the menu, but how do I change the color on selected tab to another active tab and then remove the old one? Answer You would wanna use JavaScript to achieve this. Like so:

Bootstrap toggler doesn’t hide

I am making a website using Bootstrap 5. The navbar can show the navigation when it is in a responsive viewport and I click the toggler icon, but doesn’t hide if I click it again. Looking inside the developer tools I see that the class show is still present. My html navbar: The Bootstrap scripts: The st…