Skip to main content

Posts

The first click on the image doesn't activate the onclick function

When the page loads for the first time and I press the button on the first click, it doesn't trigger the onclick function. If I press it a second and subsequent times it triggers the event. JS: var balao = document.getElementById('balao'); document.getElementById('moscovo').onclick = function () { document.getElementById("balao").style.display = "block"; balao.classList.toggle('fade'); } CSS: #balao { width: 350px; position: absolute; top: 4rem; left: 157rem; z-index: 5; display: none; opacity: 1; -webkit-transition: opacity 0.3s ease-in-out; -moz-transition: opacity 0.3s ease-in-out; -ms-transition: opacity 0.3s ease-in-out; -o-transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out; } I don't know how to solve Via Active questions tagged javascript - Stack Overflow https://ift.tt/hWwKnml

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length') for vertices of three.js

So I'm converting an html project to a laravel/vue project. The html file had a three.min.js file which I can not figure out the version of. And some custom script files. I've imported all of them for my vue component. I ran into different errors for the three.min.js file, so I npm installed version r69 of three.js becauseI read in recent versions, the geometry had changed. One of the custom files, test.js is using three.js. And I am running into the following error in my console.log Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length') at test.js?t=1674045010699:37:39 test.js file code: import * as THREE from "three"; // import ('../../assets/js/three.min.js') // import "../js/anime.js" // import "../js/three.js" var canvas = document.querySelector("#scene"); var width = canvas.offsetWidth, height = canvas.offsetHeight; var renderer = new THREE.WebGLRenderer({ canvas: canvas

MapView python librarie zoom bug

I have a problem with the python mapview library: kivy_garden.mapview: if I insert the zoom in the variable map = MapView(zoom=7) the map is completely obscured by a blue color as below you can see both the image and the code . Thanks, I await an answer. # import & from import time from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.core.window import Window from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.textinput import TextInput from kivy_garden.mapview import MapView, MapMarker from kivy.uix.popup import Popup from pyicloud import PyiCloudService class DeviceInfoPopup(Popup): def __init__(self, device_name, battery_level, altitude, **kwargs): super(DeviceInfoPopup, self).__init__(**kwargs) self.title = device_name self.chiudi = Button(text="Close", size_hint=(1, 0.2), background_color="#ff0000", on_press=self.dismiss) self.conten

How to use the Chrome BarcodeDetector from Chrome Shape Detection API in Angular?

I tried first using the BarcodeDetector in a plain JS project and it works just fine, but when trying to implement it in Angular it's not working. I get an error that the BarcodeDetector cannot be found. I would really appreciate it if someone can give me some guidance on how to approach this. I couldn't find any good example online This is my plain js implementation: let barcodeImg = document.querySelector('img'); let detectFunc = async() => { if (!('BarcodeDetector' in window)) { console.log("It's not"); } else { console.log("Barcode supported"); const barcodeDetector = new BarcodeDetector(); try { barcodeDetector.detect(barcodeImg) .then(detectedCodes => { console.log(detectedCodes); }) } catch (e) { console.log("Barcode detection failed"); } } } This is my Angular implementation: export

Animation on scroll library overflowing problem

I'm using a library called animation on scroll (aos) . Library has pretty cool and good looking animations. However, in my project it causes some overflowing issues on the html document. How can I fix this problem? The problem only occurs on sliding or fading from left animations. html document code with handlebars <div class="container"> <main> <article class="postcard dark orange"> <a class="postcard__img_link" href="/projeler/"> <img class="postcard__img" src="../images/randomForLibrary/" alt="Image Title" /> </a> <div class="postcard__text"> <h1 class="postcard__title blue"><a href="/projeler/"></a></h1> <div class="postcard__subtitle small"> <time> <i class="fa-regular fa-calendar-d

Javascript svg circular gradiant

I have a problem to solve. I want to draw a circle svg with gradient fonts based on a score. The score varies from 0 to 100. If the score is 60% for example, I have to draw 60% of the circle knowing that the gradient changes every 20%. I would like to do something like the following image but with gradients: I saw the example below which could be useful to me, but I don't understand how the coordinates of the M in path are calculated: <svg width="300" height="300"> <linearGradient id="linearColors1" x1="0" y1="0" x2="1" y2="1"> <stop offset="0%" stop-color="#01E400"></stop> <stop offset="100%" stop-color="#FEFF01"></stop> </linearGradient> <linearGradient id="linearColors2" x1="0.5" y1="0" x2="0.5" y2="1"> <stop offset="0%" sto

how to handle sign-in popups with python selenium

Using selenium I need to handle this Chrome popup on a virtual machine, even when the remote desktop connection to it is closed. I manage to get the credentials auto-filled by Chrome using my own user profile as described here . Using pyautogui to press "enter" works when I am on the VM. The challenge is to make it work after I disconnect. from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys import time from datetime import datetime, date import dateutil.relativedelta import numpy as np import pandas as pd import keyboard import os import pyautogui pyautogui.FAILSAFE = False # trying to keep sending keystrokes when remote desktop minimized or closed chrome_driver = "path/to/exe" # initial connection rooturl = 'https://myurl' options = webdriver.ChromeOptions() options.add_argument(r"--user-data-dir=C:\Users\MYUSER\AppData\Lo