-3
I’d like to put up the menu dropdown on my site when choosing variations. Both on mobile and computer.
I found this article teaching to do, but in the script I could not properly replace the terms of CSS and HTML.
The script I used: https://css-tricks.com/convert-menu-to-dropdown/
Site with dropdown template: https://www.madrugaosuplementos.com.br/100-whey-protein-2270g-optimum-nutrition-multishaker-gratis/
My website: https://www.imperiodosuplemento.com/molho-de-tomate-grape-organico-todos-os-sabores-lergurme
The script I’m adapting for my website:
<script type="text/javascript">
// Create the dropdown base
$("<ul />").appendTo("atributo-comum");
// Create default option "Go to..."
$("<option />", {
"selected": "selected",
"value" : "",
"text" : "SELECIONE..."
}).appendTo("atributo-comum ul");
// Populate dropdown with menu items
$("nav a").each(function() {
var el = $(this);
$("<option />", {
"value" : el.attr("href"),
"text" : el.text()
}).appendTo("nav select");
});
$("nav select").change(function() {
window.location = $(this).find("option:selected").val();
});
</script>
Someone can help me make it work?
Face pq vc simply does not give a None display in the menu and a display block in the select when the screen is smaller?
– hugocsl