[jquery] jQuery .scrollTop(); + animation

Code with click function()

    var body = $('html, body');

    $('.toTop').click(function(e){
        e.preventDefault();
        body.animate({scrollTop:0}, 500, 'swing');

}); 

.toTop = class of clicked element maybe img or a