js-developer-pokedex's Introduction
js-developer-pokedex's People
Forkers
renanjpaula vitorjguerra falvojr rodpro-br luizpkey gasilsantos alefaggravo john1souza nicolasmatheus gilvaniamoreira parreira01 jaisonmachado vinicius-ht naosoubruno rodrigo-monteiro-lima gustavo-akira marcos-segantine b4rry4ll3n alexdonay ulissesmarciano paulociano janagoncalo alessandrocurtinhas jaijunior flow-imagine anaflaviaveloso dalondev francivaldolima lucianolimasantos dantasdeveloperr rodrigopresida jorgelucas77 jhondoess guilhermesavioribas pertusatti22 alanbarross paulohbueno leo-albergaria gflobo hpdesenvolvedor waldivamweb21 leonardovafernandez marcos679p axlbr lucaskaspary filipe-29 douglassoares1203 luiztrigun leocarv1 yuji-fer tathykanashiro cristovaolima glaucotodesco aljacksilva moisesfontana kmlima85 borgitoh alvscarol andrefonseca99 vinidevbr febomtempo bruno-elvis renan-rs wladicosta gleicemsilva machadocabralpedro maiconjguedes eduardo-1110 lzmarangoni jasonbuenog2 viniciusst89 patriciapadilha leolagecerqueira gabsgeografo herbert-junior brunolaureano1989 m2i4l060s jamario-nascimento filipeosantos israel41 minichiello alice7h helencristina19 joelson0935 enosgb fatimoribeiro diego-rapoport apolimax rooseveltlemos wesleychristian guiladoca ivanvictor85 joaomoraisxd matheus-status-code-200 leandrossb ludmilaalmeida geovanemo lucastab0rda robbienog sebastianjonhssonjs-developer-pokedex's Issues
Reconhecer o button gerado dinamicamente.
Boa tarde,
Gostaria de uma ajuda para conseguir reconhecer um button que fiz para detectar o click no objeto para aparecer os detalhes do pokemons:
Eu modifiquei a função "convertPokemonToLi" adicionando um button, ficando assim:
function convertPokemonToLi(pokemon) {
return `
<li class="pokemon ${pokemon.type}">
-> <button class="buttonDetails" type="button">
-> Details
-> </button>
<span class="number">#${pokemon.number}</span>
<span class="name">${pokemon.name}</span>
<div class="detail">
<ol class="types">
${pokemon.types.map((type) => `<li class="type ${type}">${type}</li>`).join('')}
</ol>
<img src="${pokemon.photo}"
alt="${pokemon.name}">
</div>
</li>
`
}
Sendo assim, por cima da imagem da pokedex, será gerado um button. Deixei este button transparente, e o trouxe para frente do elemento, para ser acionável.
Como o elemento será gerado dinamicamente, acredito que seja necessário criar uma promise para segurar as referências dos buttons, cujo código é este:
const detailsButtonsPromise = new Promise((resolve) => {
document.addEventListener('DOMContentLoaded', () => {
const detailsButtons = document.querySelectorAll('.buttonDetails');
resolve(detailsButtons);
});
});
O argumento DOMContentLoaded, diz respeito a só resolver a promise após carregar a página HTML, antes dos elementos externos. E por fim, a resolução da promise, seria:
detailsButtonsPromise.then((detailsButtons) => {
debugger
console.log(detailsButtons)
detailsButtons.forEach(button => {
debugger
console.log('oi');
button.addEventListener('click', () => {
console.log(`Clicou o botão ${button.id}`);
});
});
});
Porém, ao imprimir a variável "detailsButtons" é retornado uma lista vazia. Não consigo um resultado diferente, alguém poderia me ajudar?
PokeAPI Imagens
Não consegui de jeito nenhum achar as URLs das imagens, procurei bastante na API, mas não achei.
Entrei no codigo pra colar essa parte pra nao perder mais tempo, mas aqui no codigo tbm está faltando, então não sei mais oq fazer.
os pokemons.
- Será implementado as gerações posteriores e uma página de detalhamento para todos os pokemons.
Função não reconhece como string
Na função convertPokemonToHtml, meu VSCode nao quer reconhecer o html como string, o que eu faço?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.