Skip to content
Browse files

Update jquery-nav2select.js

  • Loading branch information...
1 parent 0aa034c commit 551b70f2df767616882174766ea253a614c031a7 @danieliser committed
Showing with 13 additions and 16 deletions.
  1. +13 −16 jquery-nav2select.js
View
29 jquery-nav2select.js
@@ -1,5 +1,5 @@
(function($){
- var methods = {
+ var methods = {
init : function( options ) {
var opts = $.extend({}, $.fn.nav2select.defaults, options);
return this.each(function() {
@@ -7,28 +7,26 @@
$select = $("<select />");
// Create default option "Go to..."
$("<option />", {
- "selected": "selected",
- "value" : "",
- "text" : "Go to..."
+ "selected": "selected",
+ "value" : "",
+ "text" : "Go to..."
}).appendTo($select);
// Populate dropdown with menu items
$this.find('a').each(function() {
- var el = $(this);
- $("<option />", {
- "selected": el.attr("href") === window.location.href ? "selected" : false,
- "value" : el.attr("href"),
- "text" : el.text()
- }).appendTo($select);
+ var el = $(this);
+ $("<option />", {
+ "selected": el.attr("href") === window.location.href ? "selected" : false,
+ "value" : el.attr("href"),
+ "text" : el.text()
+ }).appendTo($select);
});
$select.appendTo($this);
$($select).change(function() {
- window.location = $(this).find("option:selected").val();
- }); // add all your scripts here
+ window.location = $(this).find("option:selected").val();
+ });
});
},
}
-
-
$.fn.nav2select = function(method) {
// Method calling logic
if ( methods[method] ) {
@@ -38,9 +36,8 @@
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.button' );
}
-
};
$.fn.nav2select.defaults = {
};
-})(jQuery);
+})(jQuery);

0 comments on commit 551b70f

Please sign in to comment.
Something went wrong with that request. Please try again.