I’m creating my own carousel and I want to add circles navigation on the bottom of slider. I am fetching data from mongoDb (3 pictures) and load them in App component and passing via props to Carousel component. I want to map trough array and set index to data-slider property and later read this with e.…
Tag: javascript
Displaying images from fetch API call Node/React
Im trying display images im fetching from API btw url is defined Gallery.js with or without the regex /[blob:]{5}/gi it is only displaying the alt prop and not the image. The image is received and the get call is successful but the objectURL url is not working. Any help? Answer const {image} = this.props.phot…
How to validate with both html pattern and a script?
I have an html form and a script, validate.js, which runs after a submit button is clicked to check if given passwords are the same. Form’s inputs fields also have pattern attributes for validation. The problem is, whenever the button is clicked, the script is executed and there is no html pattern valid…
How to close the menu when clicking on the document (EventListener)
I have been trying to add an EventListener to the document to close my menu, but it seems that none of the event.stopPropagation(); actually listen to me :/ can anyone give me a hand here? Please this is what I tried adding in the openMenu function I also tried attaching the removeEventHandler on click in the…
settimeout not working properly when i tried to use it to refresh a page
The purpose of this code is to refresh a page after either a wait time of 1 second or 5 seconds depending on a random variable. However, the code below makes it so that it either refreshes after a wait time of 1 second EVERY SINGLE TIME, or it refreshes after a wait time of 5 seconds EVERY SINGLE TIME.
JavaScript runtime error: ‘[MethodName]’ is undefined
I’m trying to use jQuery and AJAX to validate that users entered a number in a particular field and that they didn’t leave it blank and I’m a little confused as to why I can seem to do one, but not the other. I’m doing this in a jQuery change() function so any time they change the valu…
filtering array in range of array time and time now javascript
i get some trouble when i try to filtering time now in array time, i have code like this ; the problem is output not same with my expectation. i want : if timeNow is 08, timeShift output(selected) is 08, if timeNow is 07, timeShift output(selected) is 06, if timeNow is 09, timeShift output(selected) is 08, if…
Connecting actions to store outside a component?
So let’s suppose I have a store, with a redux-thunk middleware in it. I created the store and exported it like this: I can now access it anywhere in my app. But what if I want to dispatch an action from anywhere? I have them declared e.g. in myAction.js: Now I can import them and connect to my store/com…
Phaser Weapon plugin, set the kill_DISTANCE
I’m using the phaser weapon plugin, and i’ve set the kill type to kill_distance: But, it is automatically set to 2, which doesn’t really allow it to travel very far. I’m wondering how i can set it to a larger number thanks in advance Answer You can just set the bulletKillDistance: This…
How to check the sequence of opening and closing brackets in string?
Need to find open and closed bracket, if the sequence of opening and closing brackets is violated, then return false. But if don’t revert right array to compare with left array, i don’t make check brackets here {[(3+1)+2]+}. And if reverse like now, then i fail to check here [1+1]+(2*2)-{3/3} Answ…