Move bootstrap window

Asked

Viewed 932 times

1

I’m using the following code to move bootstrap windows:

$('#divform').modal({ 
    keyboard: false,
    show: true
});
//Jquery draggable
$('#divform').draggable({
    handle: ".modal-header"
});

That is, I have to make use of the explicit jquery to move the window, I wonder if the bootstrap gives this feature without needing jquery.

  • 1

    No, if you check the bootstrap documentation itself says that it uses jQuery to bring components to life.

  • 1

    http://getbootstrap.com/javascript/ "Bring Bootstrap components to life with more than a dozen custom jQuery plugins. Easily include all of them, or one by one."

  • No, you need to use jQuery to do this with bootstrap.

1 answer

1


Bootstrap so far is super resource dependent on jQuery. I recommend you go to the site and look for plugins for specific cases.

http://plugins.jquery.com/

But jQuery itself already has this "raw" functionality (as well as posted by yourself the function). But even so follows the example that is on their own site.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Draggable - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #draggable { width: 150px; height: 150px; padding: 0.5em; }
  </style>
  <script>
  $(function() {
    $( "#draggable" ).draggable();
  });
  </script>
</head>
<body>
 
<div id="draggable" class="ui-widget-content">
  <p>Me arraste!</p>
</div>
 
 
</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.