Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    120
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Bootstrap Modal Won't Auto Load On Page Load

    Hi I have come across a problem. I have tried many different way of trying to get my bootstrap modal to load on page load.

    I use codeigniter for my framework as well.

    Here is my script. I have just gone back to default form and script at the moment.

    I am trying to get it to load with out clicking on button. Any thoughts I have tried also document ready function

    Code:
    <head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="<?php echo base_url()?>javascript/bootstrap.min.js"></script>
    <script type="text/javascript">
    $('#myModal').modal('remote')
    </script>
    </div>

    Code:
    <a data-toggle="modal" href="#myModal" class="btn btn-primary btn-lg">Launch demo modal</a>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">
              ...
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              <button type="button" class="btn btn-primary">Save changes</button>
            </div>
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
      </div><!-- /.modal -->
    Founder Of Riwaka Website Designs
    http://www.riwakawebsitedesigns.com

  • #2
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    120
    Thanks
    22
    Thanked 0 Times in 0 Posts

    [Solved By Me]

    Hi If any one wants bootstrap 3 modal to load on page load with out button best use this script I was working away at it and found it. got it working

    Code:
    <script type="text/javascript">
     $(window).load(function(){
            $('#myModal').modal('show');
        });
    </script>
    Founder Of Riwaka Website Designs
    http://www.riwakawebsitedesigns.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •