Wednesday, 21 August 2013

Removing a specific element from a class

Removing a specific element from a class

I have this code, it moves every element in the class block 10 pixels to
the left. I want it to remove any of the elements which are left of 300
pixels. Why does $(this).remove() not work and what can I do to fix this?
$(".block").animate({left:"-=10"},speed,"linear",function(){
if(parseInt(this.style.left) < 300)
{
$(this).remove();
//something
}else{
//something
}
});

No comments:

Post a Comment