diff options
Diffstat (limited to 'app/lib/grappelli/media/js/documentation.js')
-rw-r--r-- | app/lib/grappelli/media/js/documentation.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/lib/grappelli/media/js/documentation.js b/app/lib/grappelli/media/js/documentation.js new file mode 100644 index 0000000..b00c120 --- /dev/null +++ b/app/lib/grappelli/media/js/documentation.js @@ -0,0 +1,21 @@ +(function($) { + $(document).ready(function(){ + // Correct the position of anchors (because "#header" & "#breadcrumbs" have a "position:fixed") + $('.table-of-contents a').click(function(){ + var myReference = ".rte " + $(this).attr('href'); + // if collapsible + var myParentCollapsible = $(myReference).parent().parent(); + if ($(myParentCollapsible).hasClass('closed')){ + $(myParentCollapsible).toggleClass('open').toggleClass('closed'); + } + // anchor offset + var targetOffset = $(myReference).offset().top; + $('html,body').scrollTop(targetOffset - 60); + return(false); + }) + // Remove emtpy elements: wrkaround for problem reported in django-ticket #11817 + $('.rte h4:empty').remove(); + $('.rte p:empty').remove(); + $('.rte hr').remove(); + }); +})(django.jQuery);
\ No newline at end of file |