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 8118831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:37:03+00:00 2026-06-06T04:37:03+00:00

I am using the modal component within the Twitter Bootstrap package. This modal opens

  • 0

I am using the modal component within the Twitter Bootstrap package. This modal opens from a button click, and its content is loaded dynamically via an Ajax call. All of the above works just fine on PC (FF, Chrome), and also on the iPad (Safari). However, on the iPad if the screen is scrolled down a bit before the button is clicked, then the backdrop for the modal will only cover part of the screen (dependent on how much the screen is scrolled down). The backdrop jumps to its correct position (covering entire screen behind the modal) if the page is scrolled at all.

Would appreciate any help with this as it looks quite ugly with the backdrop only partially covering the screen.

Things that don’t affect it:

  • the “fade” class
  • The positioning of the modal code within the DOM.
  • Manually scrolling the page via Javascript

Below I will include some stripped out code (internal controls and such removed for brevity).

The modal:

<div id="tehtavaModal" class="modal hide fade">
    <div class="modal-header">
        <a class="close" data-dismiss="modal" href="#">&times;</a>
        <h3 id="tehtavaModalOtsikko"></h3>
    </div>
    <div class="modal-body">
        <div id="tehtavaModalSisalto"></div>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal">Sulje</a>
        <a href="#" class="btn btn-primary" data-dismiss="modal">Tallenna Vastaukset</a>
    </div>
</div>

The function to open the modal:

function haeTehtava(tehtavaID) {
    $('#tehtavaModalOtsikko').html('Tehtävä');
    $('#tehtavaModalSisalto').html('<p>Tehtävää haetaan...</p>');
    $('#tehtavaModalKysymykset').html('');
    $('#myCarousel').hide();

    $.getJSON("Sivu/HaeTapahtuma", { 'tyyppi': 4, 'ID': tehtavaID }, naytaTehtava)
        .error(function () { $('#tehtavaModalSisalto').html('<div class="alert alert-error">Tehtävän haussa tapahtui virhe.</div>'); });
    $('#tehtavaModal').modal();
}

The callback function (naytaTehtava) simply populates some of the internal sections of the modal.

The link which calls the function:

<a href="#" onClick="haeTehtava(1);">Open Modal</a>

The example given on the Twitter Bootstrap page works, so I am wondering what could I possibly be doing different?

EDIT: An additional note, if the modal is opened using the data- attributes, it works fine. The problem only shows when opening the modal by script.

  • 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-06T04:37:04+00:00Added an answer on June 6, 2026 at 4:37 am

    Turns out I was looking too deep for the problem. The link which opens the modal needs to have a href=”#myModal” to set the screen to the modal. I had only a href=”#” which apparently threw off the Twitter Bootstrap modal because it was scrolling to the top of the page (and the modal was located at the scrolled location.

    Wrong way

    <a href="#" onClick="$('#myModal').modal();">Open Modal</a>
    

    Right way

    <a href="#myModal" onClick="$('#myModal').modal();">Open Modal</a>
    

    Alternatively

    <a href="" onClick="$('#myModal').modal(); return false;">Open Modal</a>
    

    Thanks goes to @baptme because going to jsFiddle made me realise why the page was scrolling.

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

Sidebar

Related Questions

I am creating a modal window using Twitter Bootstrap. The default behavior is if
I'm using the modal window component in a loop. Every loop content has X
I'm using bootstrap's modal plugin in rails The website says I can gain the
I open a form as a modal dialog using ShowDialog. This dialog in turn
After seeing tons of web site using modal window with a nice expansion animation
I am using AJAX modal popup in my project, but there is problem with
I am using jquery modal popup in my application with MVC3 Razor view. Issue
Alright. I am using a Modal box pop up window to display business details
I've got a modal popup (using ModalPopupExtender) working in a kind of master/detail view
how can I open a modal window using javascript only. I can't use own

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.