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,7 +71,7 @@ | ||
71 | <%= render :file => 'shared/categories_menu' %> | 71 | <%= render :file => 'shared/categories_menu' %> |
72 | </div><!-- id='navigation_bar' --> | 72 | </div><!-- id='navigation_bar' --> |
73 | <script type="text/javascript"> | 73 | <script type="text/javascript"> |
74 | - prepareMenu('navigation_bar', { timeout: 5 }); | 74 | + prepareMenu('navigation_bar', { timeout: 1000 }); |
75 | </script> | 75 | </script> |
76 | 76 | ||
77 | <div id='user_box'> | 77 | <div id='user_box'> |
public/javascripts/menu.js
1 | function prepareMenu(id, options) { | 1 | function prepareMenu(id, options) { |
2 | 2 | ||
3 | - var menuCloseTimeout = options.timeout || 33; | 3 | + window.menuCloseTimeout = options.timeout || 333; |
4 | 4 | ||
5 | if ( document.all ) { | 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 | $(id).className += " msie"; | 7 | $(id).className += " msie"; |
8 | } | 8 | } |
9 | 9 | ||
@@ -37,7 +37,9 @@ function prepareMenu(id, options) { | @@ -37,7 +37,9 @@ function prepareMenu(id, options) { | ||
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | } else { | 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 | this.subMenu.style.display = "block"; | 43 | this.subMenu.style.display = "block"; |
42 | clearTimeout(this.timeOutClose); | 44 | clearTimeout(this.timeOutClose); |
43 | clearTimeout(this.subMenu.timeOutClose); | 45 | clearTimeout(this.subMenu.timeOutClose); |
@@ -60,7 +62,7 @@ function prepareMenu(id, options) { | @@ -60,7 +62,7 @@ function prepareMenu(id, options) { | ||
60 | }; | 62 | }; |
61 | link.onmouseout = link.onblur = | 63 | link.onmouseout = link.onblur = |
62 | function () { | 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 | //ul.closeSubMenu = function(){ this.style.display = "none" } | 68 | //ul.closeSubMenu = function(){ this.style.display = "none" } |
@@ -76,7 +78,7 @@ function prepareMenu(id, options) { | @@ -76,7 +78,7 @@ function prepareMenu(id, options) { | ||
76 | function () { | 78 | function () { |
77 | if ( this.blurCalledByIEWorkArroundBug ) { return false } | 79 | if ( this.blurCalledByIEWorkArroundBug ) { return false } |
78 | this.blurCalledByIEWorkArroundBug = true; | 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,7 +109,7 @@ function prepareMenu(id, options) { | ||
107 | }; | 109 | }; |
108 | a.onblur = function() { | 110 | a.onblur = function() { |
109 | forceUlBlurFromLink(this); | 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 | } else { | 114 | } else { |
113 | a.onfocus = function() { forceUlFocusFromLink(this) }; | 115 | a.onfocus = function() { forceUlFocusFromLink(this) }; |