rodrigobertin
2/7/2014 - 7:56 PM

menu responsive jquery

menu responsive jquery

//RESPONSIVE MENU
jQuery(document).ready(function() {
  jQuery("<select />").appendTo(".menu");

  // Create default option "Go to..."
  jQuery("<option />", {
    "selected": "selected",
    "value": "",
    "text": "Navegar..."
  }).appendTo(".menu select");

  // Populate dropdowns with the first menu items
  jQuery(".menu ul li a").each(function() {
    var el = jQuery(this);
    jQuery("<option />", {
      "value": el.attr("href"),
      "text": el.text(),
      "id":el.attr('id')
    }).appendTo(".menu select");


  });

  //make responsive dropdown menu actually work			
  jQuery(".menu select").change(function() {
    window.location = jQuery(this).find("option:selected").val();

  });
});