Skip to content

Commit

Permalink
Merge pull request #66 from kadimi/master
Browse files Browse the repository at this point in the history
Add the "indent" option
  • Loading branch information
arielsalminen committed Feb 19, 2014
2 parents 3bbd96b + d298ead commit 67163ad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TinyNav.js
### Responsive navigation plugin that weighs just 443 bytes
### Responsive navigation plugin that weighs just 452 bytes

[TinyNav.js](http://tinynav.viljamis.com/) is a tiny jQuery plugin (443 bytes minified and gzipped) that converts `<ul>` and `<ol>` navigations to a select boxes for small screen. It also automatically selects the current page and adds `selected="selected"` for that item. There's also a Wordpress plugin available, [here](http://wordpress.org/extend/plugins/tinynav/).
[TinyNav.js](http://tinynav.viljamis.com/) is a tiny jQuery plugin (452 bytes minified and gzipped) that converts `<ul>` and `<ol>` navigations to a select boxes for small screen. It also automatically selects the current page and adds `selected="selected"` for that item. There's also a Wordpress plugin available, [here](http://wordpress.org/extend/plugins/tinynav/).

This isn't the first plugin to do this and it doesn't provides a lot of options, but it might be the smallest (file size).

Expand All @@ -18,7 +18,7 @@ License

Licensed under the MIT license.

Copyright (c) 2011-2012 Viljami Salminen, http://viljamis.com/
Copyright (c) 2011-2014 Viljami Salminen, http://viljamis.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand All @@ -30,6 +30,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Changelog
======

v1.2 (2014-02-19) - Adds the "indent" option, thanks to [@kadimi](https://github.com/kadimi)

v1.1 (2012-11-14) - Adds an optional "label" tag before the "select" tag, thanks to [@larcher](https://github.com/larcher)

v1.05 (2012-10-19) - Adds the support for multiple navigation depths, thanks to [@nicoandrade](https://github.com/nicoandrade)
Expand Down
1 change: 1 addition & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// TinyNav.js 1
$('#nav').tinyNav({
active: 'selected',
indent: '→'
label: 'Menu'
});

Expand Down
5 changes: 3 additions & 2 deletions tinynav.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*! http://tinynav.viljamis.com v1.1 by @viljamis */
/*! http://tinynav.viljamis.com v1.2 by @viljamis */
(function ($, window, i) {
$.fn.tinyNav = function (options) {

// Default settings
var settings = $.extend({
'active' : 'selected', // String: Set the "active" class
'header' : '', // String: Specify text for "header" and show header instead of the active item
'indent' : '- ', // String: Specify text for indenting sub-items
'label' : '' // String: sets the <label> text for the <select> (if not set, no label will be added)
}, options);

Expand Down Expand Up @@ -39,7 +40,7 @@
options += '<option value="' + $(this).attr('href') + '">';
var j;
for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) {
options += '- ';
options += settings.indent;
}
options += $(this).text() + '</option>';
});
Expand Down
6 changes: 3 additions & 3 deletions tinynav.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67163ad

Please sign in to comment.