Starx
Starx

Reputation: 79031

How to disable scrolling of body element?

How to disable scrolling of body? $('body').css('overflow','hidden'); only hides the scrollbars but it does not disable the scrolling. I want to disable the scrolling of the body.

But I want to keep the scrolling of other division intact.

Upvotes: 14

Views: 26601

Answers (1)

Makram Saleh
Makram Saleh

Reputation: 8701

Try this CSS, no jQuery needed for this:

<style type="text/css">
    html { overflow: hidden; }
</style>

[UPDATE after comment]

Try specifying the height of the body too:

<style type="text/css">
    html, body { overflow: hidden; height: 100% }
    body { margin:0; padding:0; }
</style>

Upvotes: 9

Related Questions