Hi all, the following is my first plug-in. I've got the code from a web site I liked and then I modified it. As a result it is not my real code, however I applied a lot of changes including the get and set methods... There are several things I don't like within it. 1) First of all, is there any other way in order to call my methods rather than $.Slider.NameOfMyMethod? 2) Why inside the function init() I am able to set var obj = $.Slider.getObjIsMenuAnimated(); but I can't define sl = $.Slider.getSlideMenu(); // it doesn't work the only way is to define var sl = $( "#slideMenu" ); 3) is there another way to get the variable value without creating get and set methods? Many thanks JH <here the script> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- var menuContainer = $( "#menuContainer" ); var slideMenu = $( "#slideMenu" ); var menuPosition = {Min: "0px",Max: "-49px"}; var timerMouseOut = null; var objIsMenuAnimated = {Show: false,Hide: false}; jQuery.Slider = { getMenuContainer: function(){ var c = menuContainer; return c; }, getSlideMenu: function(){ var s = slideMenu; return s; }, getMenuPosition: function(){ var obj = menuPosition; return obj; }, getTimerMouseOut:function(){ //tM = null; var t = timerMouseOut; return t; }, setTimerMouseOut:function(time){ //tM = null; timerMouseOut = time; }, getObjIsMenuAnimated: function(){ var o = objIsMenuAnimated; return o; }, setObjIsMenuAnimated: function(p1,p2){ objIsMenuAnimated = {Show: p1,Hide: p2}; }, init: function() { var mc = $.Slider.getMenuContainer(); var slm = $( "#slideMenu" ); $( [] ).add( mc ).add( slm ).mouseover( function(){$.Slider.ManageShowMenu(); return( false ); } ); $( [] ).add( mc ).add( slm ).mouseout( function(){$.Slider.ManageHideMenu(); return( false ); } ); }, ManageShowMenu: function() { clearTimeout($.Slider.getTimerMouseOut()); $.Slider.ShowMenu(); }, ManageHideMenu: function() { $.Slider.setTimerMouseOut( setTimeout( function(){ $.Slider.HideMenu(); }, 100 ) ); }, ShowMenu: function() { var obj = $.Slider.getObjIsMenuAnimated(); var sl = $( "#slideMenu" ); if (!obj.Show || obj.Hide){ if (obj.Hide){ sl.stop(); } $.Slider.setObjIsMenuAnimated(true,false); sl.animate( { bottom: menuPosition.Max }, { duration: 100, complete: function(){ $.Slider.setObjIsMenuAnimated(false,false); } } ); } }, HideMenu: function() { var sl = $( "#slideMenu" ); $.Slider.setObjIsMenuAnimated(false,true); sl.animate( { bottom: menuPosition.Min }, { duration: 500, complete: function(){ $.Slider.setObjIsMenuAnimated(false,false); } } ).fadeTo( 9, 9 ); } }; jakiri hutimora ha scritto:
|
- [jQuery] call a method outside a jquery object jasper saronno
- [jQuery] Re: call a method outside a jquery object Eric Garside
- [jQuery] Re: call a method outside a jquery objec... jakiri hutimora
- [jQuery] Re: call a method outside a jquery o... jakiri hutimora
- [jQuery] Re: call a method outside a jquery o... Matt Kruse
- [jQuery] Re: call a method outside a jque... jakiri hutimora
- (Work around Solution) Re: [jQuery] ... jakiri hutimora
- [jQuery] my first plugin, help t... jakiri hutimora