Im trying to duplicate something like what is shown in the video. I have 2 blocks of div. One containing a random image and another a video and im trying to make them flexible and identical as possible to the video. How can I approach this? I tried using flex box to align them horizontally then media query th…
Tag: html
How to remove background layer of an when using object-fit: contain;
I am trying to make image viewer, which has overlay window with div in the center and inside the div an image that scales up and down on window resize that keeps its default ratio by using object-fit: contain; which is working ok. The problem is that when using object-fit: contain; it scales the content of th…
Keep dropdown menu open after page refresh
There is a form inside my dropdown menu for logging in. If the user submits that form but the login details were wrong the page get refreshed and the dropdown menu closes. How do i keep the dropdown menu in an open state after refresing that page? Answer First, I would check to see if there is a way to
how to disable a function
This code will alert hello world when i press space key. And when i execute the second function, i expect it to alert “hello” when i press space key but it executes both function and alerts “hello world” and “hello” instead, so i was wondering how can i disable the function…
Javascript: Can I Use JS to Copy an HTML Element From One Page to Another?
New to JS. Couldn’t find any good solutions for this after researching, and seems like it shouldn’t be too complicated. Say I have a page called page1.html with this code: Now, I have a second page, page2.html, with this code: I want to make a copy of the div with class wrapper from page1.html, an…
How to use if(checkbox.checked) to disable a particular javascript?
I am currently experimenting with a script, and I want to add a checkbox to allow user to either activate it or not, based on their preference. I’ve simplified the sample to show only the script that I need to turn on/off (the one that makes other buttons unclickable depending on which is specified.) Ho…
How to change active class of the navbar on scroll
I tried every js code that I only could find, but nothing works, I don’t understand why, I checked console, no mistakes there. Maybe somebody can spot the mistake? Maybe I have to import some files or something else? Somehow code does not see the scroll, only when I click on the link. Is there a way to …
Convert NodeList to Array for a Stepper to work with IE
I want to create a simple Vanilla JS horizontal stepper without the addition of CSS or JS libraries. I have found this example but it doesnt work with IE browser. The problem is the following line: where he is converting the NodeList of ‘divs’ with class .bullet to Array. Is there any way to make …
how to remove class of a specific element inside an element
When I click on one of the lists, the code will put the innerHTML of the list that I clicked into a div, but I also want to remove the class of the spans in the list that is inside the div How can I do this? ive tried this but it doesnt work Answer At the moment your simply
Angular 11, how to data-bind a value from a function
I got a list of values that has to be shown, i’m using two elements for databing, here’s my component: and here’s my html document Everything works fine but one of the values I have to show is the sum of {{element.announces}} and {{element.withdraws}}, I have tried adding a ‘sum’…