Reset scroll position and selected tab in about dialog

This commit is contained in:
Gina Häußge 2016-01-12 11:00:35 +01:00
parent 04bb262187
commit 4e84d62741
2 changed files with 12 additions and 2 deletions

View file

@ -3,8 +3,12 @@ $(function() {
var self = this; var self = this;
self.aboutDialog = undefined; self.aboutDialog = undefined;
self.aboutContent = undefined;
self.aboutTabs = undefined;
self.show = function() { self.show = function() {
$("a:first", self.aboutTabs).tab("show");
self.aboutContent.scrollTop(0);
self.aboutDialog.modal({ self.aboutDialog.modal({
minHeight: function() { return Math.max($.fn.modal.defaults.maxHeight() - 80, 250); } minHeight: function() { return Math.max($.fn.modal.defaults.maxHeight() - 80, 250); }
}).css({ }).css({
@ -19,7 +23,13 @@ $(function() {
}; };
self.onStartup = function() { self.onStartup = function() {
self.aboutDialog = $('#about_dialog'); self.aboutDialog = $("#about_dialog");
self.aboutTabs = $("#about_dialog_tabs");
self.aboutContent = $("#about_dialog_content");
$('a[data-toggle="tab"]', self.aboutTabs).on("show", function() {
self.aboutContent.scrollTop(0);
});
}; };
} }

View file

@ -7,7 +7,7 @@
<div class="full-sized-box"> <div class="full-sized-box">
<div class="tabbable row-fluid"> <div class="tabbable row-fluid">
<div class="span3 scrollable" id="about_dialog_menu"> <div class="span3 scrollable" id="about_dialog_menu">
<ul class="nav nav-list" id="aboutTabs"> <ul class="nav nav-list" id="about_dialog_tabs">
{% set mark_active = True %} {% set mark_active = True %}
{% for key in templates.about.order %} {% for key in templates.about.order %}
{% set entry, data = templates.about.entries[key] %} {% set entry, data = templates.about.entries[key] %}