Author: echatellier Date: 2013-05-28 12:15:32 +0200 (Tue, 28 May 2013) New Revision: 232 Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/232 Log: Hide menu on mouse out Modified: trunk/cantharella.web/src/main/webapp/js/slidemenu.js Modified: trunk/cantharella.web/src/main/webapp/js/slidemenu.js =================================================================== --- trunk/cantharella.web/src/main/webapp/js/slidemenu.js 2013-05-27 08:18:51 UTC (rev 231) +++ trunk/cantharella.web/src/main/webapp/js/slidemenu.js 2013-05-28 10:15:32 UTC (rev 232) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below) + * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below) * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -21,7 +21,7 @@ * #L% */ var slideMenu=function(){ - var sp,st,t,m,sa,l,w,sw,ot; + var sp,st,t,m,sa,l,w,sw,ot,ssl; return{ build:function(sm,sw,mt,s,sl,h){ sp=s; st=sw; t=mt; @@ -30,9 +30,13 @@ l=sa.length; w=m.offsetWidth; sw=w/l; ot=Math.floor((w-st)/(l-1)); var i=0; for(i;i<l;i++){x=sa[i]; x.style.width=sw+'px'; this.timer(x)} - if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)} + if(sl!=null){ssl=sl;m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)} }, - timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}}, + timer:function(s){ + s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}; + s.onmouseout=function(e){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(sa[ssl-1])},t)}; + }, + slide:function(s){ var cw=parseInt(s.style.width,'10'); if(cw<st){