zoukankan      html  css  js  c++  java
  • Jquerymenuaim流畅的菜单滑动体验

    参考网址:https://github.com/kamens/jQuery-menu-aim 

    Amazon网站分类导航的下拉菜单被使用得非常频繁,但你有没有注意过它的反应非常迅速?

    如此急速的用户体验,应该相当perfect了吧。

    jQuery-menu-aim

    menu-aim is a jQuery plugin for dropdown menus that can differentiate between a user trying hover over a dropdown item vs trying to navigate into a submenu's contents.

    menu-aim assumes that you are using a menu with submenus that expand to the menu's right. It will fire events when the user's mouse enters a new dropdown item and when that item is being intentionally hovered over.

    Amazon screenshot

    This problem is normally solved using timeouts and delays. menu-aim tries to solve this by detecting the direction of the user's mouse movement. This can make for quicker transitions when navigating up and down the menu. The experience is hopefully similar to amazon.com/'s "Shop by Department" dropdown.

    Use like so:

     $("#menu").menuAim({
         activate: $.noop,  // fired on row activation
         deactivate: $.noop,  // fired on row deactivation
     });
    

    ...to receive events when a menu's row has been purposefully (de)activated.

    The following options can be passed to menuAim. All functions execute with the relevant row's HTML element as the execution context ('this'):

     .menuAim({
         // Function to call when a row is purposefully activated. Use this
         // to show a submenu's content for the activated row.
         activate: function() {},
    
         // Function to call when a row is deactivated.
         deactivate: function() {},
    
         // Function to call when mouse enters a menu row. Entering a row
         // does not mean the row has been activated, as the user may be
         // mousing over to a submenu.
         enter: function() {},
    
         // Function to call when mouse exits a menu row.
         exit: function() {},
    
         // Selector for identifying which elements in the menu are rows
         // that can trigger the above events. Defaults to "> li".
         rowSelector: "> li",
    
         // You may have some menu rows that aren't submenus and therefore
         // shouldn't ever need to "activate." If so, filter submenu rows w/
         // this selector. Defaults to "*" (all elements).
         submenuSelector: "*"
     });
    

    Want an example to learn from?

    Check out example/example.html -- it has a working dropdown for you to play with:

    Example screenshot Play with the above example full of fun monkey pictures by opening example/example.html after downloading the repo.

  • 相关阅读:
    用elasticsearch分析中国大学省份分布
    【翻译】Kinect v1和Kinect v2的彻底比较
    翻译 Tri-Ace:在Shader里近似渲染公式
    翻译 基于物理渲染的美术资源设计流程
    翻译 次世代基于物理渲染的反射模型
    关于Depth Bounds Test (DBT)和在CE3的运用
    使用Xcode GPU Frame Caputre教程
    如何使用Xcode分析调试在真机运行的UE4 IOS版游戏
    个人翻译的cedec2010基于物理的光照
    使用Nsight查找CE3的渲染bug
  • 原文地址:https://www.cnblogs.com/boonya/p/2956635.html
Copyright © 2011-2022 走看看