Version étudiants
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								img/clavier.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/clavier.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 60 KiB | 
							
								
								
									
										
											BIN
										
									
								
								img/ordinateur.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/ordinateur.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 118 KiB | 
							
								
								
									
										
											BIN
										
									
								
								img/portable.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/portable.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 104 KiB | 
							
								
								
									
										
											BIN
										
									
								
								img/routeur.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/routeur.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 68 KiB | 
							
								
								
									
										
											BIN
										
									
								
								img/souris.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/souris.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 148 KiB | 
							
								
								
									
										
											BIN
										
									
								
								img/switch.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/switch.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 52 KiB | 
							
								
								
									
										30
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
|     <title>Document</title> | ||||
|     <link rel="stylesheet" href="style.css"> | ||||
| </head> | ||||
| <body> | ||||
|  | ||||
|     <h1>Les modèles d'ordinateurs</h1> | ||||
|  | ||||
|     <ul> | ||||
|         <li id="fixe">Ordinateur fixe</li> | ||||
|         <li id="portable">Ordinateur portable</li> | ||||
|     </ul> | ||||
|  | ||||
|     <img id="img-pc" src="img/ordinateur.png" alt="ordinateur fixe"> | ||||
|  | ||||
|     <h2>Des périphériques</h2> | ||||
|  | ||||
|     <button id="btn-suivant">Image suivante</button> | ||||
|  | ||||
|     <img id="img-peripherique" src="" alt="un périphérique"> | ||||
|  | ||||
|     <button id="btn-precedent">Image précédente</button> | ||||
|  | ||||
|     <script src="script.js" defer></script> | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										22
									
								
								script.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								script.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| // A vous de jouer ! | ||||
|  | ||||
| // Identifie les deux élements de la liste fixe / portable | ||||
| const desktopLi = document.getElementById("fixe"); | ||||
| const laptopLi = document.getElementById("portable"); | ||||
|  | ||||
| // Ajouter d'un observateur d'évènement sur ces éléments, faisant appel à la fonction définie ci-dessous | ||||
| desktopLi.addEventListener("click", () => { selectComputerPicture("fixe"); }); | ||||
| laptopLi.addEventListener("click", () => { selectComputerPicture("portable"); }); | ||||
|  | ||||
| // Fonction modifiant l'application de la classe "selected" à un élément, à compléter | ||||
| function selectComputerPicture(type) { | ||||
|     if (type === "fixe") { | ||||
|         console.log("fixe") | ||||
|         desktopLi.classList.add("selected"); | ||||
|         laptopLi.classList.remove("selected"); | ||||
|     } else if (type === "portable") { | ||||
|         console.log("portable") | ||||
|         laptopLi.classList.add("selected"); | ||||
|         desktopLi.classList.remove("selected"); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user