js: scroll to highlighted object

This commit is contained in:
Thomas Gelf 2016-10-27 23:40:34 +00:00
parent 6642d8cf74
commit 0c0694605c
2 changed files with 13 additions and 0 deletions

View File

@ -108,6 +108,7 @@ pre.generated-config {
.highlight {
border-bottom: 1px dashed @gray-light;
&::before {
// icon: right-big
font-family: 'ifont';

View File

@ -239,6 +239,7 @@
this.backupAllExtensibleSetDefaultValues($container);
this.putFocusOnFirstObjectTypeElement($container);
this.highlightFormErrors($container);
this.scrollHighlightIntoView($container);
this.hideInactiveFormDescriptions($container);
if (iid = $container.data('activeExtensibleEntry')) {
$('#' + iid).focus();
@ -263,6 +264,17 @@
}
},
scrollHighlightIntoView: function ($container) {
$hl = $container.find('.highlight');
$content = $container.find('> div.content');
if ($hl.length) {
$container.animate({
scrollTop: $hl.offset().top - $content.offset().top
}, 700);
}
},
backupAllExtensibleSetDefaultValues: function($container) {
var self = this;
$container.find('.extensible-set').each(function (idx, eSet) {