Make flyover responsive

This commit is contained in:
Alexander A. Klimov 2017-11-21 18:10:50 +01:00
parent c786cb9b7e
commit bc4b9fb4e0
2 changed files with 25 additions and 1 deletions

View File

@ -277,7 +277,17 @@ ul.tree li a.error:hover {
width: 1em;
position: absolute;
left: 4px;
left: 6px;
top: -7px;
}
&.flyover-right .flyover-content {
left: auto;
right: 0;
}
&.flyover-arrow-top.flyover-right .flyover-content:before {
left: auto;
right: 6px;
}
}

View File

@ -28,6 +28,12 @@
var $this = $(this);
if (typeof expandedFlyovers['#' + $this.attr('id')] !== 'undefined') {
var $container = $this.closest('.container');
if ($this.offset().left - $container.offset().left > $container.innerWidth() / 2) {
$this.addClass('flyover-right');
}
$this.toggleClass('flyover-expanded');
}
});
@ -50,8 +56,16 @@
$flyover.toggleClass('flyover-expanded');
if ($flyover.hasClass('flyover-expanded')) {
var $container = $flyover.closest('.container');
if ($flyover.offset().left - $container.offset().left > $container.innerWidth() / 2) {
$flyover.addClass('flyover-right');
}
expandedFlyovers['#' + $flyover.attr('id')] = null;
} else {
$flyover.removeClass('flyover-right');
delete expandedFlyovers['#' + $flyover.attr('id')];
}
};