Advertisement
keha76

Responsive Menu : UL -> SELECT

Mar 6th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.64 KB | None | 0 0
  1. jQuery(function(){
  2.    
  3.     // Mobile Select Menu
  4.     jQuery("<select />").appendTo("nav#menu");
  5.     jQuery("<option />", {
  6.         "selected" : "selected",
  7.         "value"    : "",
  8.         "text"     : dp_localize.MenuItemGoto
  9.     }).appendTo("nav#menu select");
  10.  
  11.     // Select Menu Options
  12.     jQuery("nav#menu a").each(function() {
  13.         var el = jQuery(this);
  14.         jQuery("<option />", {
  15.             "value" : el.attr("href"),
  16.             "text"  : el.text()
  17.         }).appendTo("nav#menu select");
  18.     });
  19.  
  20.     // Redirect
  21.     jQuery("nav#menu select").change(function() {
  22.         window.location = jQuery(this).find("option:selected").val();
  23.     });
  24.  
  25.     // Superfish Menu
  26.     jQuery('ul.sf-menu').superfish();
  27.  
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement