bootstrap拖拽布局生成网页html代码
代码语言:html
所属分类:布局界面
代码描述:bootstrap拖拽布局生成网页html代码,只要轻轻拖动一下,一个网页布局就完成了,非常方便
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.3.3.4.css">
<style>
body {
padding-top:50px;
padding-bottom: 40px;
margin-left:200px;
-webkit-transition: margin 500ms ease;
-moz-transition: margin 500ms ease;
-ms-transition: margin 500ms ease;
-o-transition: margin 500ms ease;
transition: margin 500ms ease;
}
.navbar-layoutit .btn-donate {padding: 0 0 0 10px;}
.navbar-layoutit .btn-donate form { margin:0;}
@media (max-width: 980px) {
/* Enable use of floated navbar text */
.navbar-text.pull-right {
float: none;
padding-left: 5px;
padding-right: 5px;
}
}
@media (max-width: 979px) {
.navbar-fixed-top { position:fixed; }
}
.navbar-layoutit #menu-layoutit { float:left;}
.navbar-layoutit { min-height: 32px; padding: 5px 0 0 5px; }
.navbar-layoutit .navbar-brand {width:180px; color:#fff; padding: 0; margin:0 5px; }
.navbar-layoutit .navbar-brand img {float:left; margin:2px 10px 0 0; }
.navbar-layoutit .navbar-brand .label {
position:relative;
left:10px;
top:-3px;
font-weight:normal;
font-size:9px;
background:#666;
-webkit-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7);
-moz-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7);
box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7);
}
.edit .demo { margin-left:0px; margin-top:10px; padding:30px 15px 15px; border: 1px solid #DDDDDD; border-radius: 4px; position:relative; word-wrap: break-word;}
.edit .demo:after {
background-color: #F5F5F5;
border: 1px solid #DDDDDD;
border-radius: 4px 0 4px 0;
color: #9DA0A4;
content: "Container";
font-size: 12px;
font-weight: bold;
left: -1px;
padding: 3px 7px;
position: absolute;
top: -1px;
}
.container { width:auto; margin:0 0px;}
.sidebar-nav {
position:fixed;
width:180px;
left:0px;
bottom:0;
top:32px;
background:#ccc;
padding: 10px; z-index:10;
-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
-ms-transition: all 500ms ease;
-o-transition: all 500ms ease;
transition: all 500ms ease;
}
.sidebar-nav .nav-header { cursor:pointer; font-size:14px; color:#fff; text-shadow:0 1px 0 rgba(0, 0, 0, 0.3); text-transform:uppercase; font-weight:bold;}
.sidebar-nav .nav-header span.label { font-size:10px; /*padding-bottom:0;*/ position:relative; top:-1px; }
.sidebar-nav .nav-header i.glyphicon-question-sign { color:#000; text-shadow:0 1px 0 #ddd;}
.sidebar-nav .nav-header .popover {color:#999; text-shadow:none;}
.popover-info {position:relative;}
.popover-info .popover {display:none; top: -12.5px; left:15px; }
.popover-info:hover .popover {display:block; opacity:1; width:400px;}
.popover-info:hover .popover .arrow {top:23px;}
.sidebar-nav .accordion-group { border:none; }
.boxes {}
.sidebar-nav li { line-height:28px; margin-bottom:3px; }
.sidebar-nav li .lyrow { margin-bottom:5px;}
.sidebar-nav .box { line-height:26px; width:160px; height:26px; }
.sidebar-nav .preview { display: block; color:#666; font-size:12px; line-height:26px;}
.sidebar-nav .preview input { width:105px; padding:0 10px; background:#bbb; font-size:10px; color:#999; line-height:20px; height:20px; position:relative; top:-1px; }
.sidebar-nav .view { display: none; }
.sidebar-nav .remove,
.sidebar-nav .configuration { display: none; }
.sidebar-nav .boxes { display:none;}
.demo .preview { display: none; }
.demo .box .view { display: block; padding-top:30px;}
.ui-draggable-dragging .view { display:block;}
/*.demo .ui-sortable-placeholder { outline: 5px dotted #ddd; visibility: visible!Important; border-radius: 4px; }*/
.ui-sortable-placeholder { outline: 1px dashed #ddd;visibility: visible!Important; border-radius: 4px;}
.edit .drag { position: absolute; top: 0;right: 0; cursor: pointer; }
.edit .drag i {color:#000; text-shadow:0 1px 0 #ddd;}
.box,.lyrow { position:relative;}
.edit .demo .lyrow .drag { top:5px; right:80px; z-index:10; }
.edit .demo .column .box .drag { top:5px; }
.edit .demo .column .box .configuration {position: absolute; top: 3px; right: 140px;white-space:nowrap; }
.edit .demo .column .box .configuration:hover { z-index:1001;}
.edit .demo .column .navbar-fixed-top {top: 33px; left: 180px;}
.demo .column .navbar-fixed-top {top: 33px;}
.edit .demo .column .navbar-fixed-bottom { left: 180px;}
.edit .demo .remove { position: absolute; top: 5px; right: 5px; z-index:10; }
.demo .configuration {
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
-ms-transition: all 500ms ease;
-o-transition: all 500ms ease;
transition: all 500ms ease;
}
.demo .drag, .demo .remove {
filter: alpha(opacity=20); opacity: 0.2;
-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
-ms-transition: all 500ms ease;
-o-transition: all 500ms ease;
transition: all 500ms ease;
}
.demo .lyrow:hover > .drag,
.demo .lyrow:hover > .configuration,
.demo .lyrow:hover > .remove,
.demo .box:hover .drag,
.demo .box:hover .configuration,
.demo .box:hover .remove { filter: alpha(opacity=100); opacity: 1; }
.edit .demo .row:before {
background-color: #F5F5F5;
border: 1px solid #DDDDDD;
border-radius: 4px 0 4px 0;
color: #9DA0A4;
content: "Row";
font-size: 12px;
font-weight: bold;
left: -1px;
line-height:2;
padding: 3px 7px;
position: absolute;
top: -1px;
}
.demo .row {
background-color: #F5F5F5;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1);
border: 1px solid #DDDDDD;
border-radius: 4px 4px 4px 4px;
margin: 15px 0;
position: relative;
padding: 25px 14px 0;
}
.edit .column:after {
background-color: #F5F5F5;
border: 1px solid #DDDDDD;
border-radius: 4px 0 4px 0;
color: #9DA0A4;
content: "Column";
font-size: 12px;
font-weight: bold;
left: -1px;
padding: 3px 7px;
position: absolute;
top: -1px;
}
.column {
background-color: #FFFFFF;
border: 1px solid #DDDDDD;
border-radius: 4px 4px 4px 4px;
margin: 15px 0;
padding: 39px 19px 24px;
position: relative;
}
/* preview */
body.devpreview { margin-left:0px;}
.devpreview .sidebar-nav {
left:-200px;
-webkit-transition: all 0ms ease;
-moz-transition: all 0ms ease;
-ms-transition: all 0ms ease;
-o-transition: all 0ms ease;
transition: all 0ms ease;
}
.devpreview .drag, .devpreview .configuration, .devpreview .remove { display:none !Important; }
.sourcepreview .column, .sourcepreview .row, .sourcepreview .demo .box {
margin:0px 0;
padding:0px;
background:none;
border:none;
-webkit-box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00);
-moz-box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00);
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00);
}
.devpreview .demo .box, .devpreview .demo .row { padding-top:0; background:none; }
.devpreview .demo .column { padding-top:19px; padding-bottom:19px; }
#download-layout { display: none }
#feedbackModal textarea,
#downloadModal textarea { width:100%;height:280px;resize: none;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box; }
#feedbackModal input { width:515px; }
#feedbackModal input.modal-error-field, #feedbackModal textarea.modal-error-field { border: 1px solid red; }
a.language-selected { font-style: italic; font-weight: bold; }
.modal-body { padding-bottom:0; }
.modal-footer { margin-top:0; }
</style>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.2.11.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bootstrap-3.3.4.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.ui.touch-punch.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.htmlclean.js"></script>
<script type="text/javascript">
function handleSaveLayout() {
var e = $(".demo").html();
if (e != window.demoHtml) {
saveLayout();
window.demoHtml = e
}}
function handleJsIds() {
handleModalIds();
handleAccordionIds();
handleCarouselIds();
handleTabsIds()}
function handleAccordionIds() {
var e = $(".demo #myAccordion");
var t = randomNumber();
var n = "panel-"+t;
var r; e.attr("id", n);
e.find(".panel").each(function(e, t) {
r = "panel-element-"+randomNumber();
$(t).find(".panel-title").each(function(e, t) {
$(t).attr("data-parent", "#"+n);
$(t).attr("href", "#"+r)});
$(t).find(".panel-collapse").each(function(e, t) {
$(t).attr("id", r)})})}
function handleCarouselIds() {
var e = $(".demo #myCarousel");
var t = randomNumber();
var n = "carousel-"+t;
e.attr("id", n);
e.find(".carousel-indicators li").each(function(e, t) {
$(t).attr("data-target", "#"+n)});
e.find(".left").attr("href", "#"+n);
e.find(".right").attr("href", "#"+n)}
function handleModalIds() {
var e = $(".demo #myModalLink");
var t = randomNumber();
var n = "modal-container-"+t;
var r = "modal-"+t; e.attr("id", r);
e.attr("href", "#"+n);
e.next().attr("id", n)}
function handleTabsIds() {
var e = $(".demo #myTabs");
var t = randomNumber();
var n = "tabs-"+t;
e.attr("id", n);
e.find(".tab-pane").each(function(e, t) {
var n = $(t).attr("id");
var r = "panel-"+randomNumber();
$(t).attr("id", r);
$(t).parent().parent().find("a[href=#"+n+"]").attr("href", "#"+r)})}
function randomNumber() {
return randomFromInterval(1, 1e6)}function randomFromInterval(e, t) {
return Math.floor(Math.random()*(t-e+1)+e)}function gridSystemGenerator() {
$(".lyrow .preview input").bind("keyup", function() {
var e = 0; var t = ""; var n = false; var r = $(this).val().split(" ", 12); $.each(r, function(r, i) {
if (!n) {
if (parseInt(i) <= 0)n = true; e = e+parseInt(i); t += '<div class="col-md-'+i+' column"></div>'
}}); if (e == 12&&!n) {
$(this).parent().next().children().html(t); $(this).parent().prev().show()} else {
$(this).parent().prev().hide()}})}function configurationElm(e, t) {
$(".demo").delegate(".configuration > a",
"click",
function(e) {
e.preventDefault(); var t = $(this).parent().next().next().children(); $(this).toggleClass("active"); t.toggleClass($(this).attr("rel"))}); $(".demo").delegate(".configuration .dropdown-menu a",
"click",
function(e) {
e.preventDefault(); var t = $(this).parent().parent(); var n = t.parent().parent().next().next().children(); t.find("li").removeClass("active"); $(this).parent().addClass("active"); var r = ""; t.find("a").each(function() {
r += $(this).attr("rel")+" "
}); t.parent().removeClass("open"); n.removeClass(r); n.addClass($(this).attr("rel"))})}function removeElm() {
$(".demo").delegate(".remove",
"click",
function(e) {
e.preventDefault(); $(this).parent().remove(); if (!$(".demo .lyrow").length > 0) {
clearDemo()}})}function clearDemo() {
$(".demo").empty()}function removeMenuClasses() {
$("#menu-layoutit li button").removeClass("active")}function changeStructure(e, t) {
$("#download-layout ."+e).removeClass(e).addClass(t)}function cleanHtml(e) {
$(e).parent().append($(e).children().html())}function downloadLayoutSrc() {
var e = ""; $("#download-layout").children().html($(".demo").html()); var t = $("#download-layout").children(); t.find(".preview, .configuration, .drag, .remove").remove(); t.find(".lyrow").addClass("removeClean"); t.find(".box-element").addClass("removeClean"); t.find(".lyrow .lyrow .lyrow .lyrow .lyrow .removeClean").each(function() {
cleanHtml(this)}); t.find(".lyrow .lyrow .lyrow .lyrow .removeClean").each(function() {
cleanHtml(this)}); t.find(".lyrow .lyrow .lyrow .removeClean").each(function() {
cleanHtml(this)}); t.find(".lyrow .lyrow .removeClean").each(function() {
cleanHtml(this)}); t.find(".lyrow .removeClean").each(function() {
cleanHtml(this)}); t.find(".removeClean").each(function() {
cleanHtml(this)}); t.find(".removeClean").remove();
$("#download-layout .column").removeClass("ui-sortable");
$("#download-layout .row-fluid").removeClass("clearfix").children().removeClass("column"); if ($("#download-layout .container").length > 0) {
changeStructure("row-fluid", "row")}
formatSrc = $.htmlClean($("#download-layout").html(), {
format: true,allowedAttributes:[["id"],["class"],["data-toggle"],["data-target"],["data-parent"],["role"],["data-dismiss"],["aria-labelledby"],["aria-hidden"],["data-slide-to"],["data-slide"]]});$("#download-layout").html(formatSrc);$("#downloadModal textarea").empty();$("#downloadModal textarea").val(formatSrc)}var currentDocument=null;var timerSave=2e3;var demoHtml=$(".demo").html();$(window).resize(function(){$("body").css("min-height",$(window).height()-90);$(".demo").css("min-height",$(window).height()-160)});$(document).ready(function(){$("body").css("min-height",$(window).height()-90);$(".demo").css("min-height",$(window).height()-160);$(".demo, .demo .column").sortable({connectWith:".column",opacity:.35,handle:".drag"});$(".sidebar-nav .lyrow").draggable({connectToSortable:".demo",helper:"clone",handle:".drag",drag:function(e,t){t.helper.width(400)},stop:function(e,t){$(".demo .column").sortable({opacity:.35,connectWith:".column"})}});$(".sidebar-nav .box").draggable({connectToSortable:".column",helper:"clone",handle:".drag",drag:function(e,t){t.helper.width(400)},stop:function(){handleJsIds()}});$("[data-target=#downloadModal]").click(function(e){e.preventDefault();downloadLayoutSrc()});$("#download").click(function(){downloadLayout();return false});$("#downloadhtml").click(function(){downloadHtmlLayout();return false});$("#edit").click(function(){$("body").removeClass("devpreview sourcepreview");$("body").addClass("edit");removeMenuClasses();$(this).addClass("active");return false});$("#clear").click(function(e){e.preventDefault();clearDemo()});$("#devpreview").click(function(){$("body").removeClass("edit sourcepreview");$("body").addClass("devpreview");removeMenuClasses();$(this).addClass("active");return false});$("#sourcepreview").click(function(){$("body").removeClass("edit");$("body").addClass("devpreview sourcepreview");removeMenuClasses();$(this).addClass("active");return false});$(".nav-header").click(function(){$(".sidebar-nav .boxes, .sidebar-nav .rows").hide();$(this).next().slideDown()});removeElm();configurationElm();gridSystemGenerator();setInterval(function(){handleSaveLayout()},timerSave)})
</script>
</head>
<body style="min-height: 857px;" class="edit">
<div class="navbar navbar-inverse navbar-fixed-top navbar-layoutit">
<div class="navbar-header" style="height:26px;overflow:hidden;">
<button data-target="navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
<span class="glyphicon-bar"></span>
<span class="glyphicon-bar"></span>
<span class="glyphicon-bar"></span>
</button>
<a class="navbar-brand" href="/">
Bootstrap3拖拽布局
</a>
</div>
<div class="collapse navbar-collapse.........完整代码请登录后点击上方下载按钮下载查看
网友评论0