2

I have a bootstrap modal on the screen. When the modal is showed, it is positioned on the center of the screen.

<div class="modal fade" id="ua_dialog">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
        <div class="modal-body">
        ....
        </div>
      </div>

I need to move the modal on my screen, because cover some information from my screen. The user should be able to move on the right, on the left...etc. Can I do that? there is some settings that I can use? or with js? what is the best way? Thanks!

Orsi
  • 545
  • 2
  • 10
  • 27
  • Possible duplicate of [how to change the default positioning of modal in bootstrap?](https://stackoverflow.com/questions/24731307/how-to-change-the-default-positioning-of-modal-in-bootstrap) – CBroe Dec 07 '17 at 11:08
  • _“I need to move the modal on my screen, because cover some information from my screen.”_ - if you have information outside the modal that still needs to be accessible, that might rather suggest that a modal is the wrong thing to use here in the first place ... – CBroe Dec 07 '17 at 11:09
  • It covers a map which needs to be visible. Can I make the modal to be movable? Or I need to position the modal to be for example on the right of the screen? – Orsi Dec 07 '17 at 11:13
  • _“Can I make the modal to be movable?”_ - can you please start doing your own basic research …? https://stackoverflow.com/q/12591597/1427878 – CBroe Dec 07 '17 at 11:15

2 Answers2

8

I think You Need This :)

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div>
<div class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      </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 --> 
</div>

<script>
        $('.modal').modal({ keyboard: false,
                           show: true
        });
        // Jquery draggable
        $('.modal-dialog').draggable({
            handle: ".modal-header"
        });
</script>  
Karan Mehta
  • 395
  • 2
  • 9
0

.modal-content{
    margin-top:50px !important;
}
chv
  • 105
  • 1
  • 11