Skip to content

Instantly share code, notes, and snippets.

@kylewest
Last active February 14, 2017 03:15
Show Gist options
  • Save kylewest/67e4c1fdb6f65cadeb80 to your computer and use it in GitHub Desktop.
Save kylewest/67e4c1fdb6f65cadeb80 to your computer and use it in GitHub Desktop.
brands-dropdown.html
<!-- Copy and paste this code to Configuration -> Website -> Custom HTML <head> -->
<script type="text/javascript">
$(document).ready(function(){
$('#brandlist ul').hide().parent().append('<select>'); $('#brandlist ul li').each(function(){ var link = $(this).find('a');
$('#brandlist select').append('<option value="'+link.attr('href')+'">'+link.html()+'</option>');
});
$('#brandlist select').on("change", function(){
window.location.href = $(this).val();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment