Widget:Test: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Sem resumo de edição |
Sem resumo de edição |
||
Linha 22: | Linha 22: | ||
} | } | ||
.image-container img { | .image-container img { | ||
width: | width: 300px; /* Tamanho fixo para as imagens */ | ||
margin-bottom: 10px; | margin-bottom: 10px; | ||
} | } |
Edição das 03h56min de 23 de agosto de 2024
<!DOCTYPE html> <html lang="pt-BR"> <head>
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Seleção e Exibição de Imagens</title> <style> .hidden { display: none; } .image-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; } .image-container .image-item { flex: 1 0 45%; /* Ajustado para exibir duas imagens por linha */ max-width: 45%; text-align: center; } .image-container img { width: 300px; /* Tamanho fixo para as imagens */ margin-bottom: 10px; } .image-info { margin-top: 5px; } select { margin: 5px; } </style>
</head> <body>
Selecione o Tipo de Mapa
<form id="mapForm">
<label for="mapType">Tipo de Mapa:</label> <select id="mapType"> <option value="">Selecione um mapa</option> <option value="1">Mapa Vermelho</option> <option value="2">Mapa Verde</option> <option value="3">Mapa Roxo</option> </select>
<label for="specificOption">Local do X:</label> <select id="specificOption"> <option value="">Selecione uma opção</option> <option value="Areia">Areia</option> <option value="Gelo">Gelo</option> <option value="Grama">Grama</option> <option value="Pedra">Pedra</option> <option value="Subaquático">Subaquático</option> <option value="Terra">Terra</option> <option value="Pisos">Pisos</option> </select>
</form>
<script> const specificOptions = { 1: { // Mapa Vermelho 'Areia': [ { local: 'Green Island', coordinates: '3780, 3326, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, { local: 'Wildwind Island', coordinates: '3969, 3300, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, { local: 'Wildwind Island', coordinates: '4002, 3320, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, { local: 'Hurricane Island', coordinates: '4166, 3302, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, { local: 'Shell Island', coordinates: '4266, 3359, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, { local: 'Shell Island', coordinates: '4299, 3333, 6', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' } ], 'Gelo': [ { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' }, { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' }, { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' }, { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' }, { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' }, { local: 'Cerulean', coordinates: '1456, 2345, 4', imageUrl: 'https://wiki.pokexgames.com/images/4/43/AnotherImage.png' } ], 'Grama': [ { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' }, { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' }, { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' }, { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' }, { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' }, { local: 'Vermilion', coordinates: '5678, 1234, 5', imageUrl: 'https://wiki.pokexgames.com/images/3/34/DifferentImage.png' } ], 'Pedra': [ { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' }, { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' }, { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' }, { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' }, { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' }, { local: 'Lavender', coordinates: '6789, 2345, 2', imageUrl: 'https://wiki.pokexgames.com/images/c/c4/ExampleImage.png' } ], 'Subaquático': [ { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' }, { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' }, { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' }, { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' }, { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' }, { local: 'Celadon', coordinates: '1234, 5678, 3', imageUrl: 'https://wiki.pokexgames.com/images/5/56/AnotherExample.png' } ], 'Terra': [ { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' }, { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' }, { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' }, { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' }, { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' }, { local: 'Fuchsia', coordinates: '4567, 6789, 1', imageUrl: 'https://wiki.pokexgames.com/images/6/67/ExampleTerra.png' } ], 'Pisos': [ { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' }, { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' }, { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' }, { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' }, { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' }, { local: 'Cinnabar', coordinates: '7890, 1234, 6', imageUrl: 'https://wiki.pokexgames.com/images/7/78/ExamplePisos.png' } ] }, 2: { // Mapa Verde // Adicionar dados para o Mapa Verde aqui }, 3: { // Mapa Roxo // Adicionar dados para o Mapa Roxo aqui } };
document.getElementById('mapType').addEventListener('change', function() { const selectedMapType = this.value; const specificOptionSelect = document.getElementById('specificOption');
if (selectedMapType) { specificOptionSelect.innerHTML = '<option value="">Selecione uma opção</option>'; const options = Object.keys(specificOptions[selectedMapType]); options.forEach(option => { specificOptionSelect.innerHTML += `<option value="${option}">${option}</option>`; }); document.getElementById('specificOptions').classList.remove('hidden'); } else { document.getElementById('specificOptions').classList.add('hidden'); } });
document.getElementById('specificOption').addEventListener('change', function() { const selectedMapType = document.getElementById('mapType').value; const selectedOption = this.value; const imageContainer = document.getElementById('imageContainer'); if (selectedMapType && selectedOption) { const images = specificOptions[selectedMapType][selectedOption]; let imagesHtml = ;
if (Array.isArray(images)) { images.forEach(image => { imagesHtml += `
<img src="${image.imageUrl}" alt="${selectedOption}">
Local: ${image.local}
Coordenada: ${image.coordinates}
`; }); } else { imagesHtml = `
<img src="${images.imageUrl}" alt="${selectedOption}">
Local: ${images.local}
Coordenada: ${images.coordinates}
`; } imageContainer.innerHTML = imagesHtml; imageContainer.classList.remove('hidden'); } else { imageContainer.classList.add('hidden'); } }); </script>
</body> </html>