just stay aware of the scope: var oldthis = this; this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ oldthis.setContent(); oldthis.fadeIn(1000) }); } ;
On Feb 9, 3:13 pm, Creativebyte <michaelhaszpru...@googlemail.com> wrote: > Hello group, > > I got a problem with a JS class I am writing. I got the following > piece of code: > > this.slide=function(){ > $(this.container_selector_contents).fadeOut(1000, function(){ > this.setContent(); > this.fadeIn(1000) > }); > } > > The problem is, that inside the fadeOut() function "this" is now not > the class but the jQuery element. So, how can I access my classes > methods and variables again sine I can't use "this"? > > Thanks for your help!