How to affix dropdown list menu next to selected dropdown button when user scrolling?

别等时光非礼了梦想. 提交于 2019-12-12 01:36:08

问题


I have faced the similar problem occurred on this page as in my App. When a user selects the drop-down list it will open drop-down menu. But, When the user scroll down the page, the drop-down menu is still on the same position.

How to resolve this?

Thanks in advance.


回答1:


I've recently faced this type of issue.

So I've used mouseenter,mouseleave events.

$( ".menu-open" )
  // not necessary 
  .mouseenter(function() {
    $( this ).show();
  })
  // you must put this to hide menu when user leaves the menu
  .mouseleave(function() {
    $( this ).hide();
  });

Well so by using above code it will hide the menu as soon as user moves cursor out of the menu.

It will be quite good experience for users as well, like they don't care if menu get closed when they don't need it more. but if it will kept open unless user again click on menu to close it so feel odd.

Like the same I get from your given e.g. link.

Or else you can use scroll event like once user scroll down to specific value you can check if menu is opened then you can hide it.



来源:https://stackoverflow.com/questions/36645087/how-to-affix-dropdown-list-menu-next-to-selected-dropdown-button-when-user-scrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!