用户滚动时如何在下拉菜单旁边选中下拉列表菜单? [英] How to affix dropdown list menu next to selected dropdown button when user scrolling?

查看:114
本文介绍了用户滚动时如何在下拉菜单旁边选中下拉列表菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我曾经遇到过与这个页面类似的问题。当用户选择下拉列表时,它将打开下拉菜单。但是,当用户向下滚动页面时,下拉菜单仍然处于相同的位置。



如何解决?



提前感谢

解决方案

我最近遇到这种类型的问题。

所以我使用了mouseenter,mouseleave事件。

  $(.menu -open)
//不必要
.mouseenter(function(){
$(this).show();
})
//你必须当用户离开菜单时,将其隐藏菜单
.mouseleave(function(){
$(this).hide();
});

所以通过使用上面的代码,一旦用户将光标移出菜单,它就会隐藏菜单。



对用户来说也是一个非常好的体验,就像他们不需要更多的菜单关闭一样。但是如果用户再次点击菜单来关闭它,那么它会保持打开状态,所以感觉很奇怪。



链接



否则您可以使用滚动事件像一旦用户向下滚动到特定值,您可以检查是否打开菜单,然后可以隐藏它。


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.

解决方案

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.

这篇关于用户滚动时如何在下拉菜单旁边选中下拉列表菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆