Html – How to use disable scrolling on click in jQuery

htmljqueryscroll

Trying to disable scrolling if the user clicks a button.
I have tried:

$(window).bind('scroll');

Inside a click function, but that doesn't work. Could someone help me?
I have looked around and couldn't find a straight answer or a working solution.

Best Answer

Use CSS:

body{overflow:hidden;}

jQuery:

$("button").click(function(){
  $("body").css("overflow","hidden");
});