mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
parent
b9e0a80479
commit
b8b649f179
@ -389,7 +389,7 @@
|
|||||||
// This is an anchor only
|
// This is an anchor only
|
||||||
if (href.substr(0, 1) === '#' && href.length > 1
|
if (href.substr(0, 1) === '#' && href.length > 1
|
||||||
&& href.substr(1, 1) !== '!') {
|
&& href.substr(1, 1) !== '!') {
|
||||||
icinga.ui.focusElement(href.substr(1));
|
icinga.ui.focusElement(href.substr(1), $a.closest('.container'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,16 +126,16 @@
|
|||||||
* Focus the given element and scroll to its position
|
* Focus the given element and scroll to its position
|
||||||
*
|
*
|
||||||
* @param {string} element The name or id of the element to focus
|
* @param {string} element The name or id of the element to focus
|
||||||
* @param {object} $container Optional, the container containing the element
|
* @param {object} $container The container containing the element
|
||||||
*/
|
*/
|
||||||
focusElement: function(element, $container) {
|
focusElement: function(element, $container) {
|
||||||
var $element = $('#' + element);
|
var $element = $('#' + element, $container);
|
||||||
|
|
||||||
if (! $element.length) {
|
if (! $element.length) {
|
||||||
// The name attribute is actually deprecated, on anchor tags,
|
// The name attribute is actually deprecated, on anchor tags,
|
||||||
// but we'll possibly handle links from another source
|
// but we'll possibly handle links from another source
|
||||||
// (module etc) so that's used as a fallback
|
// (module etc) so that's used as a fallback
|
||||||
$element = $('[name="' + element.replace(/'/, '\\\'') + '"]');
|
$element = $('[name="' + element.replace(/'/, '\\\'') + '"]', $container);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($element.length) {
|
if ($element.length) {
|
||||||
@ -143,16 +143,9 @@
|
|||||||
$element.attr('tabindex', -1);
|
$element.attr('tabindex', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof $container === 'undefined') {
|
|
||||||
$container = $element.closest('.container');
|
|
||||||
}
|
|
||||||
|
|
||||||
$element.focus();
|
$element.focus();
|
||||||
|
$container.scrollTop(0);
|
||||||
if ($container.length) {
|
$container.scrollTop($element.first().position().top);
|
||||||
$container.scrollTop(0);
|
|
||||||
$container.scrollTop($element.first().position().top);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user