博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Jquery-menu-aim流畅的菜单滑动体验
阅读量:4315 次
发布时间:2019-06-06

本文共 2340 字,大约阅读时间需要 7 分钟。

参考网址: 

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.

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:

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

转载于:https://www.cnblogs.com/boonya/archive/2013/03/12/2956635.html

你可能感兴趣的文章
matlab综合实验题库,数学实验matlab题库答案
查看>>
oracle wri$_adv_objects突增,SYSTEM Tablespace — oracle-tech
查看>>
python抓取oracle数据,python爬虫,抓取oracle-base上的一些常用脚本
查看>>
oracle分页用子查询,[亲测]Oracle查询--子查询,分页查询(二)
查看>>
oracle动态语句怎么传参数值,DATAX动态参数数据传递
查看>>
php怎么设置文本区域,PHP txt下载不写文本区域内容
查看>>
linux各个目录名称,描述Linux发行版的系统目录名称命名规则以及用途
查看>>
linux 脚本里切换用户密码,shell,切换用户,执行指定,脚本
查看>>
linux配置无密码登陆,Linux下配置ssh无密码登录
查看>>
linux视频对讲qt方案,QT下视频通话的实现
查看>>
顺序串c语言,数据结构c语言实现定长顺序串
查看>>
sql的一个查询,情景:a表中存在的数据,且在b表中不存在 (not in,not exists...
查看>>
关于MDK编译器优化产生的一个小问题
查看>>
为什么说 Java 程序员到了必须掌握 Spring Boot 的时候?
查看>>
Prefixes and Suffixes
查看>>
HMAC256 Token
查看>>
HDU 2586 + HDU 4912 最近公共祖先
查看>>
POJ 3481 SBT做法
查看>>
Css 后代选择器与子代选择器的区别
查看>>
广播技术
查看>>