javascript - How to pass a variable to jQuery's .fadeOut() -


i have object want pass .fadeout().

before that, here's how can pass object .click():

this.$title.click({story: this}, function (event){     var story = event.data.story; } 

simple enough.

now want similar .fadeout:

this.$title.fadeout("fast", {story: this}, function(){     var story = ??? }); 

which doesn't work. idea? how can pass this anon function?

i'm looking cleanest solution. barring that, i'm looking solution that's in line i've done .click().

thanks!

aside: there cleaner way pass this .click()?

this rather question js jquery; can that:

var story =  this.$title.click(function () {   /* story still available */ })  this.$title.fadeout('fast', function () {   /* same here */ }) 

or more fancy (this preserves content of story @ moment of assignment if gets overwritten in upper scope later on):

this.$title.click((function (story) {   return function () {     /* story available */     /* passed $(...).click(...) */   } })(this)) 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -