$('.search-button').on('click', function(e){
e.preventDefault(); //If this method is called, the default action of the event will not be triggered.
$(this).hide();
$('.search-field').animate({'width':'toggle'}); });
pass the event e as argument and cancel the default behaviour
that will work
1
solved Prevent jQuery from Scrolling on Fixed Nav [duplicate]