Reputation: 10250
I am new to JS and jQuery. Lately I have taken a fancy to jQuery. Now i have this below snippet of code :
$('#move').click(function(){
$('#block').animate({
'left' : '+=50px'
}, 500).this.call(this, get_fx());
});
function get_fx(){
var store = console.log($(this).queue('fx').length);
}
What the above snippet is supposed to do is on click of the button, move the div by 50 pixels and then calls the function get_fx()
to check the number of animations attached to $('#block')
.
Somehow my call()
function is not working. I basically want to call the get_fx()
function of $('#block')
, obviously inside get_fx()
the this is pointing to get_fx()
so I have to use call()
or some other way of changing the context of the this inside get_fx()
to $('#block')
.
So to sum up my question how can I make the below work:
this.call(this, get_fx());
I have referred the jQuery docs while coding but my JS is not so great! I would really appreciate any help .
Thank you.
Alexander .
Upvotes: 0
Views: 28