Selectmenu drop move on resize
I am using jquery-ui selectmenu and noticed that if you leave the dropdown menu open and resize your window, the navigation menu will move regardless of the one selected.
Here's a scenario with full inventory use:
http://jsfiddle.net/kirkbross/65q0fL5r/
It's weird that the example on the jqueryui site doesn't have this problem, even if it's the same code.
Is there an easy solution for this?
$(function() {
$( "#select" ).selectmenu();
});
+3
source to share
1 answer
Here is my quickfix: In the window, resize, close and reopen the selectmenu if it is currently open:
$(window).resize(function() {
$('.js-selectmenu').each(function() {
var open = $(this).next().attr('aria-expanded') == 'true';
if (open) {
$(this).selectmenu("close");
$(this).selectmenu("open");
}
});
});
+3
source to share