summaryrefslogtreecommitdiff
path: root/lib/grappelli/media/js/documentation.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/grappelli/media/js/documentation.js')
-rw-r--r--lib/grappelli/media/js/documentation.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/grappelli/media/js/documentation.js b/lib/grappelli/media/js/documentation.js
new file mode 100644
index 0000000..b00c120
--- /dev/null
+++ b/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