Sha256: e35ad7d529efdd68770494f879c526707ffc8c21f6ebd754befd48dd5a519c1d

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

$(function(){
    $('#toc').toc()
});

$.extend($.fn,{
    toc: function(){
        toc = $(this);
        $("h2,h3,h4,h5,h6").each(function(){
            var indent = $(this).get()[0].localName.replace("h", "");
            var target = $(this);
            li = $("<li style='text-indent:"+(indent-2)+"em;'></li>");
            li.html($('<a>'+$(this).text()+'</a>').click(function(){
                $('html,body').animate({scrollTop: target.offset().top - 40},400);
            }));
            li.appendTo($(toc));
        });
    }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
leandocument-0.0.2 public/javascripts/application.js
leandocument-0.0.1 public/javascripts/application.js