hernansartorio / hernansartorio/jquery-nice-select
List out of window
- Dominant language
- JavaScript
- Stars
- 955
- Forks
- 271
- PR merge metrics
- No merged PRs in 30d
Description
May be this will help some guys.
**TODO: Manage "$(window).resize()"**
`
// Open/close
$(document).on('click.nice_select', '.nice-select', function(event) {
var $dropdown = $(this);
var $list = $dropdown.find('.list'); // NEW LINE
$('.nice-select').not($dropdown).removeClass('open');
$dropdown.toggleClass('open');
if ($dropdown.hasClass('open')) {
$dropdown.find('.option');
$dropdown.find('.focus').removeClass('focus');
$dropdown.find('.selected').addClass('focus');
// NEW LINES
if($list.attr('style')) $list.removeAttr('style'); // Reset
var maxHeight = ($(window).innerHeight() - $list.offset().top - 60); // "60" => spacing
if($list.height() > maxHeight)
{
$list.css({
'height': maxHeight,
'overflow-y': 'auto',
'-webkit-overflow-scrolling': 'touch'
});
}
} else {
$dropdown.focus();
if($list.attr('style')) $list.removeAttr('style'); // NEW LINE
}
});
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.