I solved the problem. The auto setting of jquery is not handled for some reason. So I did something like this:
$(document).on('click', '.guest' ,function(){
const is = $(this).hasClass('rotate');
const action = $(this).attr('data-action');
if( is !== true ){
$(this).addClass('rotate');
$('ul#select').animate({"height":"0"},100);
}else if(is === true ){
$(this).removeClass('rotate');
let length = $('ul#select li.element').length;
let height = $(li.element').height();
$('ul#select').animate({"height":length*height+"px"},100,{
$('ul#select').css("height"."auto");
});
}
});