Hello
J'ai un soucis , un toggle qui reste ouvert au lancement du resultat avec une recherche avancée type "avec note" ou "plat moins cher", du coup sur mobile le haut de page est masqué, pas cool ..
Comment le fermer..?
<script>
// read fields from the advanced search form and call back the same page with parameters
function doSearch() {
var panel = $("#searchoptions");
var search = document.getElementById('recherchetext').value;
// using the advanced search options
if (panel.css('display') != 'none') {
var rb1 = document.getElementById('rb_note').checked;
var rb2 = document.getElementById('rb_avg').checked;
var rb3 = document.getElementById('rb_less').checked;
var rb4 = document.getElementById('rb_more').checked;
var rapportqp = document.getElementById('rapportqp').checked;
var note1 = document.getElementById('avec_note').checked;
//var note2 = document.getElementById('sans_note').checked;
var video1 = document.getElementById('avec_video').checked;
//var video2 = document.getElementById('sans_video').checked;
var mange1 = document.getElementById('mange').checked;
//var mange2 = document.getElementById('pas_mange').checked;
var maxcost = document.getElementById('maxcost').value;
document.location.href = "resultats.php?recherche=" + escape(search)
+ "&maxcost=" + maxcost
+ "&review=" + (note1?1:3) // (note1+2*note2)
+ "&video=" + (video1?1:3) // (video1+2*video2)
+ "&mange=" + (mange1?1:3) // (mange1+2*mange2)
+ "&sort=" + (rb1+2*rb2+3*rb3+4*rb4)
+ "&rapportqp=" + (rapportqp?1:0);
} else { // not using the advanced search options
var maxcost = document.getElementById('maxcost2').value;
document.location.href = "resultats.php?recherche=" + escape(search) + "&maxcost=" + maxcost;
}
return false;
}
// Expand / collapse the advanced search panel
function toggleAdvancedSearch() {
var option1 = $("#option1");
var panel = $("#searchoptions");
var btn = $("#advsearchbutton");
if (panel.css('display') == 'none') {
panel.show();
option1.hide();
btn.removeClass("advsearchbuttondown").addClass("advsearchbuttonup");
} else {
panel.hide();
option1.show();
btn.removeClass("advsearchbuttonup").addClass("advsearchbuttondown");
}
}
// do search on enter key pressed
function enterKey(e) {
if (typeof e == 'undefined' && window.event)
e = window.event;
if (e.keyCode == 13)
doSearch();
}
</script>
<!--form id='formsearch' action="resultats.php" method="get" name="form_search"-->
<input class="input-search" placeholder="Entrez une ville ou resto ou plat..." type="search" id="recherchetext"
value="<?php echo htmlentities($_SESSION["recherche"]);?>" onkeypress="enterKey(event)" />
<input class="recherche" type="button" value="Go!" name="submit_search" onclick="doSearch()" title='Rechercher'"/>
<div id='advsearchbutton' class="advsearchbuttondown" onclick="toggleAdvancedSearch()" title='Cliquez pour une recherche avancée'>
<a class="advsearchbuttondown"></a></div>
<div id='option1' ></div>
<!--<div id='option1' style='<?php if ($_SESSION["sort"]>'') echo "display:none" ?>'>
Pas plus de <input id='maxcost2' style="width:50px;text-align:right" type="number" min="1" step="1"
onkeypress="enterKey(event)" value="<?php echo $_SESSION['maxcost']?>"> € par personne
</div><br>-->
<!-- content of the popup window with the advanced search options -->
<div id='searchoptions' style='<?php if ($_SESSION["sort"]=='') echo "display:none" ?>'>
<!--<table style='width:100%'>
<tr><td style='padding: 8px 0 0 5px;'><strong>Recherche avancée</strong></td><tr>
</table>-->
<div class="searchbarA">
<table class="searchtable">
<tr class="tr-search">
<td class="td-search">Trier par :</td>
<td class="radio-search">
<input class="input-radio" type='radio' name='rbsort' id='rb_note' <?php if ($_SESSION['sort']<'2') echo "checked"; ?>><span class="span-radio">note</span>
<input class="input-radio" type='radio' name='rbsort' id='rb_avg' <?php if ($_SESSION['sort']=='2') echo "checked"; ?>><span class="span-radio">Prix moyen</span>
<input class="input-radio" type='radio' name='rbsort' id='rb_less' <?php if ($_SESSION['sort']=='3') echo "checked"; ?>><span class="span-radio">Menu moins cher</span>
<input class="input-radio" type='radio' name='rbsort' id='rb_more' <?php if ($_SESSION['sort']=='4') echo "checked"; ?>><span class="span-radio">Menu plus cher</span>
</td></tr>
<tr><td style='text-align:right;vertical-align:baseline'>Avec </td>
<td colspan="2"><input class="input-radio" type='checkbox' id='rapportqp' <?php if ($_SESSION['rapportqp']=='1') echo "checked"; ?>><span class="span-radio-A"> meilleur RQP</span> <input class="input-radio" type='checkbox' id='avec_note' <?php if ($_SESSION['review']=='1') echo "checked"; ?>><span class="span-radio"> un article détaillé</span>
<!--<br><input type='checkbox' id='sans_note' <?php if ($_SESSION['review']!='1') echo "checked"; ?>> sans article détaillé-->
<input class="input-radio" type='checkbox' id='avec_video' <?php if ($_SESSION['video']=='1') echo "checked"; ?>><span class="span-radio-A"> une video </span>
<!--<br><input type='checkbox' id='sans_video' <?php if ($_SESSION['video']!='1') echo "checked"; ?>> sans video-->
<input class="input-radio" type='checkbox' id='mange' <?php if ($_SESSION['mange']=='1') echo "checked"; ?>><span class="span-radio"> On a Testé</span>
<!--<br><input type='checkbox' id='pas_mange' <?php if ($_SESSION['mange']!='1') echo "checked"; ?>> non visité-->
</tr>
<tr></tr>
</table>
<table class="searchtable-B">
<tr><td> Pas plus de</td><td><input id='maxcost' style="width:60px;text-align:right" type="number" min="1" step="1" onkeypress="enterKey(event)"
value="<?php echo $_SESSION['maxcost']?>"> € par personne</td>
</tr>
</table>
</div>
</div>
<!--/form-->
Juste le script js alors :-) (mais comme yen a aussi dans le PHP....
<script>
// read fields from the advanced search form and call back the same page with parameters
function doSearch() {
var panel = $("#searchoptions");
var search = document.getElementById('recherchetext').value;
// using the advanced search options
if (panel.css('display') != 'none') {
var rb1 = document.getElementById('rb_note').checked;
var rb2 = document.getElementById('rb_avg').checked;
var rb3 = document.getElementById('rb_less').checked;
var rb4 = document.getElementById('rb_more').checked;
var rapportqp = document.getElementById('rapportqp').checked;
var note1 = document.getElementById('avec_note').checked;
//var note2 = document.getElementById('sans_note').checked;
var video1 = document.getElementById('avec_video').checked;
//var video2 = document.getElementById('sans_video').checked;
var mange1 = document.getElementById('mange').checked;
//var mange2 = document.getElementById('pas_mange').checked;
var maxcost = document.getElementById('maxcost').value;
document.location.href = "resultats.php?recherche=" + escape(search)
+ "&maxcost=" + maxcost
+ "&review=" + (note1?1:3) // (note1+2*note2)
+ "&video=" + (video1?1:3) // (video1+2*video2)
+ "&mange=" + (mange1?1:3) // (mange1+2*mange2)
+ "&sort=" + (rb1+2*rb2+3*rb3+4*rb4)
+ "&rapportqp=" + (rapportqp?1:0);
} else { // not using the advanced search options
var maxcost = document.getElementById('maxcost2').value;
document.location.href = "resultats.php?recherche=" + escape(search) + "&maxcost=" + maxcost;
}
return false;
}
// Expand / collapse the advanced search panel
function toggleAdvancedSearch() {
var option1 = $("#option1");
var panel = $("#searchoptions");
var btn = $("#advsearchbutton");
if (panel.css('display') == 'none') {
panel.show();
option1.hide();
btn.removeClass("advsearchbuttondown").addClass("advsearchbuttonup");
} else {
panel.hide();
option1.show();
btn.removeClass("advsearchbuttonup").addClass("advsearchbuttondown");
}
}
// do search on enter key pressed
function enterKey(e) {
if (typeof e == 'undefined' && window.event)
e = window.event;
if (e.keyCode == 13)
doSearch();
}
</script>