Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:21:03+00:00 2026-06-05T14:21:03+00:00

I want my body to stop scrolling when using the mousewheel while the Modal

  • 0

I want my body to stop scrolling when using the mousewheel while the Modal (from http://twitter.github.com/bootstrap) on my website is opened.

I’ve tried to call the piece of javascript below when the modal is opened but without success

$(window).scroll(function() { return false; });

AND

$(window).live('scroll', function() { return false; });

Please note our website dropped support for IE6, IE7+ needs to be compatible though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:21:04+00:00Added an answer on June 5, 2026 at 2:21 pm

    Bootstrap’s modal automatically adds the class modal-open to the body when a modal dialog is shown and removes it when the dialog is hidden. You can therefore add the following to your CSS:

    body.modal-open {
        overflow: hidden;
    }
    

    You could argue that the code above belongs to the Bootstrap CSS code base, but this is an easy fix to add it to your site.

    Update 8th feb, 2013
    This has now stopped working in Twitter Bootstrap v. 2.3.0 — they no longer add the modal-open class to the body.

    A workaround would be to add the class to the body when the modal is about to be shown, and remove it when the modal is closed:

    $("#myModal").on("show", function () {
      $("body").addClass("modal-open");
    }).on("hidden", function () {
      $("body").removeClass("modal-open")
    });
    

    Update 11th march, 2013
    Looks like the modal-open class will return in Bootstrap 3.0, explicitly for the purpose of preventing the scroll:

    Reintroduces .modal-open on the body (so we can nuke the scroll there)

    See this: https://github.com/twitter/bootstrap/pull/6342 – look at the Modal section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to edit following code.(This code is come from [http://stackoverflow.com/a/9280414/945688] <!DOCTYPE html> <html>
I'm using the jQuery chosen plugin ( http://harvesthq.github.com/chosen/ ) on one of my forms
I want to set body of Html email from String, not Xml Node for
I want to check if a table body ( tbody ) is empty using
I want the body gradient to start right below where the header gradient ends.
I have a RadioButtnList. I want change body background color based on radio button
I want to style mail body. I have tried the below methods to style
I want to get Httpresponse body in php.I have used pear.but it gives me
I want to get exact height of the body of webbrowser window. I tried
I want to add these rules in my css body{ overflow-x:hidden; overflow-y:hidden; } But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.