Permalink
Browse files

Added a checkbox to toggle floating of the quick-ref TOC sidebar.

  • Loading branch information...
1 parent c5dcf45 commit e7ed7030c8592980175ad0f7ad31e7977850db06 @zk zk committed Nov 20, 2010
@@ -19,7 +19,12 @@
<%= render :partial => 'lib_nav', :locals => {:lib => @library} %>
<div class="clear"></div>
<div class="toc">
- <h2>Table of Contents</h2>
+ <h2>Table of Contents</h2>
+ <div class="toc_controls">
+ <input type="checkbox" id="floating_toc" name="floating_toc" checked="checked" />
+ <label for="floating_toc">Float TOC</label>
+ </div>
+
<% @spheres.each do |s| %>
<div class="sphere">
<h3><a class="scroll" href="#<%= CGI::escape(s[:name].gsub(/\//, "-")) %>"><%= s[:name] %></a></h3>
@@ -90,4 +95,4 @@
<%= render :partial => '/lib_namespaces' %>
</div> -->
</div>
-<div class="container_16">
+<div class="container_16">
View
@@ -32,7 +32,11 @@ CD.showMessage = function(text) {
// see quick ref / management pages
jQuery.fn.makeTOCSideBar = function() {
- var el = $(this)
+ var el = $(this)
+ var floatingToc = $("#floating_toc")
+ var floatToc = true
+
+ floatingToc.attr('checked', floatToc)
var startTop = el.offset().top;
@@ -49,11 +53,21 @@ jQuery.fn.makeTOCSideBar = function() {
}
}
- $(window).scroll(function (event) {
- updateTocPosition(el, startTop);
- });
+ $(window).scroll(function (event) {
+ if(floatToc) {
+ updateTocPosition(el, startTop);
+ }
+ });
+
+ floatingToc.click(function() {
+ floatToc = !floatToc
+
+ if(!floatToc) {
+ el.removeClass('fixed')
+ }
+ })
- updateTocPosition(el, startTop);
+ updateTocPosition(el, startTop);
}
//Behavior for input fields with descriptive text that goes away when focused
@@ -1117,3 +1117,11 @@ span.version {
}
+.toc_controls {
+ font-size: 8pt;
+ margin-top: 0px;
+}
+
+.toc_controls input {
+ font-size: 8pt;
+}

0 comments on commit e7ed703

Please sign in to comment.