Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Vital-Vuillaume authored Aug 27, 2023
1 parent a8fdb54 commit 61e70a0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
23 changes: 22 additions & 1 deletion My-Website.css
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,31 @@ body {

font-size: 1.2em;
color: red;
margin-top: 20px;
margin-top: 15px;

}

.txtRecherche {

position: relative;
top: 100px;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;

}

.imgRecherche {

background-image: url(recherche.png);
width: 100px;
height: 100px;
background-position: center;
background-size: cover;

}

/*---------------------------
--------Page accueil---------
---------------------------*/
Expand Down
16 changes: 11 additions & 5 deletions My-Website.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const btnDark = document.querySelector('.btnDark');
const BtnEcran = document.querySelector('.btnEcran');
const Recherche = document.querySelector('.recherche');
const resultats = document.querySelector('.resultats');
const txtRecherche = document.querySelector('.txtRecherche');

//-----Afficher la section 1 par defaut----\\

Expand Down Expand Up @@ -141,18 +142,18 @@ const customSearches = {

//-----Input qui recherche-----\\

Recherche.addEventListener('input', showResults);

function showResults() {
Recherche.addEventListener('input', function() {
const searchTerm = Recherche.value.trim().toLowerCase();
localStorage.setItem('previousSearch', searchTerm);

if (searchTerm === '') {
txtRecherche.style.display = 'flex';
clearResults();
} else {
txtRecherche.style.display = 'none';
displaySearchResults(searchTerm);
}
}
});

function clearResults() {
resultats.innerHTML = '';
Expand Down Expand Up @@ -199,7 +200,12 @@ window.addEventListener('load', function() {
const previousSearch = localStorage.getItem('previousSearch');
if (previousSearch) {
Recherche.value = previousSearch;
showResults();
if (previousSearch === '') {
txtRecherche.style.display = 'flex';
} else {
txtRecherche.style.display = 'none';
displaySearchResults(previousSearch);
}
}
});

Expand Down
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<link rel="icon" href="icone.ico" type="image/x-icon">
<link rel="icon" href="icone.png" type="image/png">
<link rel="icon" type="image/svg+xml" href="icone.svg">
<link rel="mask-icon" href="icone.svg" color="blue">
<title>Vital-Website</title>
</head>

Expand All @@ -33,6 +32,11 @@
<div class="containerRecherche">
<input class="recherche" type="text" placeholder="Rechercher un projet...">
<div class="resultats"></div>
<div class="txtRecherche">
<div class="imgRecherche"></div>
<p class="hbj">Regarder tout mes projets</p>
<p class="hbj">Site, Collaboration, Réseau etc...</p>
</div>
</div>
</div>

Expand Down

0 comments on commit 61e70a0

Please sign in to comment.