Oh, I thought setContent() was one of his class' methods. Does it make sense to do something like this.slide=function() {.. on a jQuery object?
On Feb 9, 5:57 pm, Eric Garside <gars...@gmail.com> wrote: > Yea, the scope should be fine. You just have to wrap "this" in "$()" > when using the reference to the element. > > On Feb 9, 2:09 pm, SoulRush <saavedra....@gmail.com> wrote: > > > Did you try with > > > $(this).setContent(); > > > instead of > > > this.setContent(); > > > ? > > > On 9 feb, 14:13, 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!