如何解决IE11忽略了Gridstack的JS方法来动态创建新元素
我正在构建一个包含Gridstack网格的网页。我这样初始化:
<script type="text/javascript">
var grid = GridStack.init({
acceptWidgets: false,// Accept widgets from other grids or from outside.
alwaysShowResizeHandle: true,// Should resize handle be visible at all times or only at hover.
animate: false,// ???
auto: true,// Should Gridstack automaticaly initialize it's items?
cellHeight: "155px",// One cell height.
column: 48,// Number of columns to which to snap to.
disableDrag: false,// Eanble or disable dragging.
disableOneColumnMode: true,// disable "one-column" mode when width equals minimal width.
disableResize: false,// Enable or disable resizing.
draggable: true,// ???
dragOut: true,// Prevent dragging items outside of their parent element.
float: true,// Enable floating tiles.
handle: '.grid-stack-item-content',// Select draggable handle class.
handleClass: 'grid-stack-item-content',// Select draggable handle class (override).
itemClass: 'grid-stack-item',// Choose class,which will be treated as a tile.
maxRow: 12,// Maximum rows where zero means unlimited.
minRow: 1,// Minimum rows to prevent empty grid from colapsing.
minWidth: 768,// Constant width which determines,when "one-column" mode is triggered.
oneColumnDomSort: false,// ???
placeholderClass: 'grid-stack-placeholder',// Select placeholder class.
placeholderText: '',// Text inside a placeholder.
resizable: { // Should resize handle be visible at all times or only at hover (override).
autoHide: false,handles: 'n,nw,w,sw,s,se,e,ne'
},removeable: false,// Enables removing of tiles if they are dragged outside of the grid.
removeTimeout: 2000,// Time in "ms" before tiles dragged out of the grid are removed.
row: 48,// Fixed number of rows where zero means unlimited.
rtl: false,// Right to left mode.
staticGrid: false,// Prevent any kind of resizing or drag & drop functionalities.
verticalMargin: 20,// Vertical gap between tiles.
});
</script>
然后我使用以下方法动态创建小部件,即平铺:
<!-- Gridstack: Example of adding a tile i.e. widget -->
<script>
grid.addWidget(`
<div>
<div class="grid-stack-item-content">
<p>...</p>
</div>
</div>`,1,true,48,"ID");
</script>
这将在Chromium,Firefox,Edge中创建窗口小部件。但不是在IE11中。有人知道我在做什么错吗?看来我正在manual ...
这是IE11中的控制台日志:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。