基于Bootstrap的可拖拽式网格系统插件
源码介绍
jquery.gridstrap.js是一款基于Bootstrap的可拖拽式网格系统插件。该插件可以快速生成基于bootstrap响应式网格的、可以自由拖拽的网格布局。 安装: 在HTML文件中引入。 然后通过下面的代码来初始化插件。 jquery.gridstrap.js插件的github网址为:https://github.com/rosspi/gridstrap.js简要教程
使用方法
npm install jquery.gridstrap
<link href="dist/jquery.gridstrap.min.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-3.2.1.js"></script>
<script src="dist/jquery.gridstrap.min.js"></script>
HTML结构
<div id="grid" class="row">
<div class="col-xs-4 col-sm-2 col-md-1"></div>
<div class="col-xs-4 col-sm-2 col-md-1"></div>
...
</div>
初始化插件
$(function(){
$('#grid').gridstrap({
/* default options */
});
});
配置参数
$.Gridstrap.defaultOptions = {
gridCellSelector: '>*', // jQuery selector for grid's cells relative to parent element.
hiddenCellClass: 'gridstrap-cell-hidden', // class applied to 'hidden' cells.
visibleCellClass: 'gridstrap-cell-visible', // class applied to 'visible' cells.
nonContiguousPlaceholderCellClass: 'gridstack-noncontiguous', // class applied to non-contiguous placeholder cells.
dragCellClass: 'gridstrap-cell-drag', // class applied to dragging cell.
resizeCellClass: 'gridstrap-cell-resize', // class applied to resizing cell.
mouseMoveSelector: 'body', // jQuery selector to bind mousemouse and mouseup events.
visibleCellContainerParentSelector: null, // jQuery selector to append 'visible' cell container to. Null will use the element the plugin is initialised on.
visibleCellContainerClass: 'gridstrap-container', // class applied to the cell container element.
getHtmlOfSourceCell: function ($cell) { // function to return the html of a 'source' cell.
return $cell[0].outerHTML;
},
dragCellHandleSelector: '*', // jQuery selector relative to and including cell for drag handling.
draggable: true, // toggle mouse dragging.
rearrangeOnDrag: true, // toggle the triggering of rearranging cells before mouseup.
resizeHandleSelector: null, // jQuery selector relative to cell for resize handling. Null disables.
resizeOnDrag: true, // toggle mouse resizing.
swapMode: false, // toggle swap or insert mode when rearranging cells.
nonContiguousCellHtml: null, // html to use for non-contiguous placeholder cells.
autoPadNonContiguousCells: true, // toggle adding non-contiguous cells automatically on drag or as otherwise needed.
updateCoordinatesOnWindowResize: true, // enable window resize event handler.
debug: false, // toggle console output.
dragMouseoverThrottle: 150, // throttle cell mouseover events for rearranging.
windowResizeDebounce: 50, // debounce redraw on window resize.
mousemoveDebounce: 0 // debounce mousemove for dragging cells.
};
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 基于Bootstrap的可拖拽式网格系统插件
发表评论 取消回复