Commit 8383b80f4db23a90ce2a3d5824712661d0a3cd9c
1 parent
ade040c4
Exists in
master
and in
29 other branches
ActionItem152: menu delay (para pessoas com dificuldades para controlar o mouse)
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1251 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
9 additions
and
7 deletions
Show diff stats
app/views/layouts/application.rhtml
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | <%= render :file => 'shared/categories_menu' %> |
72 | 72 | </div><!-- id='navigation_bar' --> |
73 | 73 | <script type="text/javascript"> |
74 | - prepareMenu('navigation_bar', { timeout: 5 }); | |
74 | + prepareMenu('navigation_bar', { timeout: 1000 }); | |
75 | 75 | </script> |
76 | 76 | |
77 | 77 | <div id='user_box'> | ... | ... |
public/javascripts/menu.js
1 | 1 | function prepareMenu(id, options) { |
2 | 2 | |
3 | - var menuCloseTimeout = options.timeout || 33; | |
3 | + window.menuCloseTimeout = options.timeout || 333; | |
4 | 4 | |
5 | 5 | if ( document.all ) { |
6 | - // add a class for work arround msie´s css bugs | |
6 | + // add a class for work arround msie's css bugs | |
7 | 7 | $(id).className += " msie"; |
8 | 8 | } |
9 | 9 | |
... | ... | @@ -37,7 +37,9 @@ function prepareMenu(id, options) { |
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | } else { |
40 | - link.className += " menu-opened" | |
40 | + if ( window.openedMenu ) window.openedMenu.closeSubMenu(); | |
41 | + window.openedMenu = this.subMenu; | |
42 | + this.className += " menu-opened" | |
41 | 43 | this.subMenu.style.display = "block"; |
42 | 44 | clearTimeout(this.timeOutClose); |
43 | 45 | clearTimeout(this.subMenu.timeOutClose); |
... | ... | @@ -60,7 +62,7 @@ function prepareMenu(id, options) { |
60 | 62 | }; |
61 | 63 | link.onmouseout = link.onblur = |
62 | 64 | function () { |
63 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), menuCloseTimeout ); | |
65 | + this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | |
64 | 66 | }; |
65 | 67 | |
66 | 68 | //ul.closeSubMenu = function(){ this.style.display = "none" } |
... | ... | @@ -76,7 +78,7 @@ function prepareMenu(id, options) { |
76 | 78 | function () { |
77 | 79 | if ( this.blurCalledByIEWorkArroundBug ) { return false } |
78 | 80 | this.blurCalledByIEWorkArroundBug = true; |
79 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), menuCloseTimeout ); | |
81 | + this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | |
80 | 82 | }; |
81 | 83 | }); |
82 | 84 | |
... | ... | @@ -107,7 +109,7 @@ function prepareMenu(id, options) { |
107 | 109 | }; |
108 | 110 | a.onblur = function() { |
109 | 111 | forceUlBlurFromLink(this); |
110 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), menuCloseTimeout ); | |
112 | + this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | |
111 | 113 | }; |
112 | 114 | } else { |
113 | 115 | a.onfocus = function() { forceUlFocusFromLink(this) }; | ... | ... |