Permalink
Browse files

Release 0.1.1

  • Loading branch information...
1 parent fa25a28 commit ff3b941d4709588427824e1f0a9f81b19dc271cd @jgallen23 committed Oct 5, 2012
Showing with 26 additions and 13 deletions.
  1. +7 −0 History.md
  2. +16 −10 dist/jquery.toc.js
  3. +2 −2 dist/jquery.toc.min.js
  4. +1 −1 lib/copyright.js
View
@@ -1,4 +1,11 @@
+0.1.1 / 2012-10-05
+==================
+
+ * updated example
+ * code cleanup, fixed onHighlight, removed console.log
+ * Add headerText and itemClass options
+
0.1.0 / 2012-07-05
==================
View
@@ -1,6 +1,6 @@
/*!
* jquery.toc.js - A jQuery plugin that will automatically generate a table of contents.
- * v0.0.3
+ * v0.1.1
* https://github.com/jgallen23/toc
* copyright JGA 2012
* MIT License
@@ -86,16 +86,16 @@ $.fn.toc = function(options) {
//build TOC item
var a = $('<a/>')
- .text($h.text())
- .attr('href', '#' + opts.anchorName(i, heading, opts.prefix))
- .bind('click', function(e) {
- scrollTo(e);
- el.trigger('selected', $(this).attr('href'));
- });
+ .text(opts.headerText(i, heading, $h))
+ .attr('href', '#' + opts.anchorName(i, heading, opts.prefix))
+ .bind('click', function(e) {
+ scrollTo(e);
+ el.trigger('selected', $(this).attr('href'));
+ });
var li = $('<li/>')
- .addClass(opts.prefix+'-'+$h[0].tagName.toLowerCase())
- .append(a);
+ .addClass(opts.itemClass(i, heading, $h, opts.prefix))
+ .append(a);
ul.append(li);
});
@@ -109,11 +109,17 @@ jQuery.fn.toc.defaults = {
selectors: 'h1,h2,h3',
smoothScrolling: true,
prefix: 'toc',
- onHighlighted: function() {},
+ onHighlight: function() {},
highlightOnScroll: true,
highlightOffset: 100,
anchorName: function(i, heading, prefix) {
return prefix+i;
+ },
+ headerText: function(i, heading, $heading) {
+ return $heading.text();
+ },
+ itemClass: function(i, heading, $heading, prefix) {
+ return prefix + '-' + $heading[0].tagName.toLowerCase();
}
};
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
/*!
* jquery.toc.js - A jQuery plugin that will automatically generate a table of contents.
- * v0.1.0
+ * v0.1.1
* https://github.com/jgallen23/toc
* copyright JGA 2012
* MIT License

0 comments on commit ff3b941

Please sign in to comment.