BootStrap modal实现拖拽功能
作者:请大声叫我帅哥 发布时间:2024-04-18 09:43:48
标签:bootStrap,modal,拖拽
bootstrap中有javascript插件modal也就是对话框,加入拖拽功能,具体内容如下
在使用modal时首选需要引用js
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
<script src="//cdn.bootcss.com/jqueryui/1.11.4/jquery-ui.js"></script> // 完成拖拽功能
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.js"></script> // 完成Modal
编辑Html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BootStrap Modal</title>
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="stylesheet">
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
<script src="//cdn.bootcss.com/jqueryui/1.11.4/jquery-ui.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.js"></script>
</head>
<body>
<button class="btn btn-default">显示Modal</button>
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</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 -->
<script type="text/javascript">
var $button = $('.btn-default'),
$modal = $('#myModal');
$(function(){
$button.on('click',function(event) {
event.preventDefault();
/* Act on the event */
$modal.show(
'500',
function() {
var modal = $(this);
modal.find('.modal-title').text('New message to ');
$.ajax({});
});
$modal.modal('show');
});
});
</script>
</body>
</html>
要完成拖拽功能需要修改一下javascript
<script type="text/javascript">
var $button = $('.btn-default'),
$modal = $('#myModal');
$(function(){
$button.on('click',function(event) {
event.preventDefault();
/* Act on the event */
$modal.show(
'500',
function() {
var modal = $(this);
modal.find('.modal-title').text('New message to ');
$.ajax({});
});
/* 完成拖拽 */
$modal.draggable({
cursor: "move",
handle: '.modal-header'
});
$modal.modal('show');
});
});
</script>
推荐
有关bootstrap modal插件使用详细请看:链接地址
来源:https://blog.csdn.net/xiaoreqing/article/details/51610906


猜你喜欢
- 我就废话不多说了,大家还是直接看代码吧~#coding=utf-8import cv2import numpy as npimg=cv2.i
- 在实际信息系统开发中,经常会用到各种各样的协议,网络协议常用的有http,tcp,udp等,传输数
- 第一,两者的功能不同。global关键字修饰变量后标识该变量是全局变量,对该变量进行修改就是修改全局变量,而nonlocal关键字修饰变量后
- 这一段CSS代码相当简单,目的就是想用CSS来控制某段文字的显示与隐藏。起初我采用了下面的代码,令人不可思议的是,它们在我的IE6.0上居然
- 目录项目地址:1) 启动方法2) web查看方法3) 功能说明:4) 展示:代码项目地址:https://github.com/guodon
- 如下所示:# -*- coding: utf-8 -*-# 简述:话说有一对可爱的兔子,出生后的第三个月开始,每一月都会生一对小兔子。# 当
- Python字符串和字典相关操作的实例详解字符串操作:字符串的 % 格式化操作:str = "Hello,%s.%s enough
- 标题显而易见,要说两种情况:重新打开页面或者返回某个页面时滚动到上次离开时的位置,以及不滚动保持在顶部。滚动这也有两种情况:页面重新打开,与
- Python入门教程FROM:http://www.cnblogs.com/taowen/articles/11239.aspx作者:tao
- 先看看单条 SQL 语句的分页 SQL 吧。 方法1: 适用于 SQL Server 2000/2005 代码如下:SELECT TOP 页
- 数据:一个db,2000个表格,2000张表格数据,每条记录30个column,平均每张表格4.3w条记录,总共86388670条记录。机器
- 本文实例讲述了python实现查找excel里某一列重复数据并且剔除后打印的方法。分享给大家供大家参考。具体分析如下:在python里面ex
- 1.选择最有效率的表名顺序(只在基于规则的优化器中有效) SQLSERVER的解析器按照从右到左的顺序处理FROM子句中的表名,因此FROM
- 如果按本文操作遇到一些问题报错,如C:\Users\milyyy\AppData\Roaming\npm-cache\_logs\2018-
- 一.执行代码yum install xz-devel yum install python-backports-lzmapip3 insta
- 1. 为什么要使用协程在上一篇中,我们从生成器的基本认识与使用,成功过渡到了协程。但一定有许多人,只知道协程是个什么东西,但并不知道为什么要
- 一、python中对文件、文件夹操作时经常用到的os模块和shutil模块常用方法。1.得到当前工作目录,即当前Python脚本工作的目录路
- 今天一个同事报告一个问题,表都不能使用了,检查了一下,发现问题 db2 => select * from testACTNO ACTK
- <% Dim aData aData = Array(3,2,4,1,6
- python+selenium编写实现爬虫过程:1.爬虫循环处理table表,2.table表分页处理,3.网页table所有内容循环处理4