Skip to content
Snippets Groups Projects
Commit e738f3a7 authored by chang-zhao's avatar chang-zhao
Browse files

Update toolbar.js

When the picker button is near the border of the screen, then an opening panel of picker buttons can go over the screen edge. That's not convenient. So we should add a check in a `function pickerToggle()` and shift picker buttons position if needed.
parent 04b2c4dc
No related branches found
No related tags found
No related merge requests found
......@@ -243,7 +243,20 @@ function pickerToggle(pickerid,$btn){
} else {
$picker.addClass('a11y').attr('aria-hidden', 'true');
}
$picker.offset({left: pos.left+3, top: pos.top+$btn[0].offsetHeight+3});
var picker_left = pos.left + 3,
picker_width = $picker.width(),
window_width = jQuery(window).width();
if (picker_width > 300) {
$picker.css("max-width", "300");
picker_width = 300;
}
if ((picker_left + picker_width + 40) > window_width) {
picker_left = window_width - picker_width - 40;
}
if (picker_left < 0) {
picker_left = 0;
}
$picker.offset({left: picker_left, top: pos.top+$btn[0].offsetHeight+3});
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment