diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index a79f942e39..c6685b316f 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -1,6 +1,6 @@ // Javascript to toggle the dropdowns $(document).ready(function(){ - // Dropdowns + $("body").bind("click", function(e) { $("ul.menu-dropdown").hide(); $('a.menu').parent("li").removeClass("open").children("ul.menu-dropdown").hide(); @@ -21,4 +21,53 @@ $(document).ready(function(){ $parentSiblings.removeClass("open"); return false; }); + + //table sort example + $("#sortTableExample").tablesorter( {sortList: [[1,0]]} ); + + //add on + $('.add-on :checkbox').click(function() { + if ($(this).attr('checked')) { + $(this).parents('.add-on').addClass('active'); + } else { + $(this).parents('.add-on').removeClass('active'); + } + }); + + + //scroll spyer + var activeTarget, + $window = $(window), + position = {}, + nav = $('body > .topbar li a'), + targets = nav.map(function () { + return $(this).attr('href'); + }), + offsets = $.map(targets, function (id) { + return $(id).offset().top; + }); + + + function setButton(id) { + nav.parent("li").removeClass('active'); + $(nav[$.inArray(id, targets)]).parent("li").addClass('active'); + } + + function processScroll(e) { + var scrollTop = $window.scrollTop() + 10, i; + for (i = offsets.length; i--;) { + if (activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1])) { + activeTarget = targets[i]; + setButton(activeTarget); + } + } + } + + nav.click(function () { + processScroll(); + }); + + processScroll(); + + $window.scroll(processScroll); }); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 93adeac60e..ccaf2235c6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,20 +4,18 @@ Twitter Baseline - + - + - - + - @@ -622,12 +620,6 @@

Example: Zebra-striped w/ TableSorter.js

Taking the previous example, we improve the usefulness of our tables by providing sorting functionality via jQuery and the Tablesorter plugin. Click any column's header to change the sort.

- - @@ -675,18 +667,7 @@
- - +