I’m trying to build and add a custom cursor on my website created using CSS/JS. Everything compiles fine and the webpage loads normally until you move the mouse… even 1 pixel. Upon moving the mouse, the webpage crashes, and I get the TypeError: Cannot read property ‘setAttribute’ of nu…
Tag: css
Detect collision (video game js)
I am building a video game where fireballs drop from the top screen. The spaceship, moved by controllers, must avoid those fireballs in order win. My issue is that I do not know how to detect when the spaceship collides into fireballs. However, I found this link: Detect if animated object touched another obje…
Why the onclick only works if you click twice?
I was searching for autocomplete examples in pure javascript, and I found a pretty good example on JSFiddle, but it has a Bug that I’m trying to figure it out how to fix. The autocomplete only autocompletes the text if you click at the paragraph twice Code: Answer On change event is trigger before the c…
How can I create custom tooltips for each data point in a graph?
I have a stacked bar graph where I want to show the proportion of projects for which our qualitative analyst needs to complete the thematic coding process. However, the visitors to the webpage won’t necessarily know the context, but will just want some details in tooltips. I have two categories: (1) Tot…
Can’t apply margin-right to relatively positioned element
I am working in Vue to build a series of cards that scroll across a mobile screen in the x-direction. It’s sort of like a testimonial section where the user can scroll right or left to see new testimonials. I am able to apply a left margin to the cards however I can’t add a right margin to the fin…
Using variables in onclick (keep old variable value even if changed later)
I have a problem where I need to dynamically add onclick events in javascript buttons using variables that the user gives. The problem: These variables will change, but I dont want the onclick events to all change!! I wrote up a mini example that mimics the setup I have (but obviously getting rid of unnecessa…
How to change CSS class to an children inside a SVG?
I am making and animation the objetive is change the xlink:href inside a SVG. (this is for change a shape), and change class respect to their position inside. This is my SVG The class in every rectelement, has a different animation-delay according to position (first execute at 0s, second at 2s, third at 4s an…
Items flex item is left-aligned and right-aligned, how to center it when the browser window is resized down?
I have a navbar with 3 flex items as shown below, and I can’t seem to figure out how to center the containers when vertically collapsed. When I shrink the browser this is the result – How do I center the B logo as well as the icons container at the bottom to be vertically centered to the middle wh…
How to set the value of a background Image in Vue using a URL generated by an API
I am trying to set the value of the background image of my #app element in Vue to the response that is generated from Unsplash’s API. I am able to retrieve the image URL, but I am having some difficulty in trying to relay that information to the background style element. Overall, my goal is to use a ran…
How to apply display: flex and flex-direction: row in JavaScript?
I want to apply display: flex and flex-direction: row with the following code: Answer Assign the styles to the parent element that you have selected: You can also assign them all at once: