欺诈小部件内的UL标签

UL tag inside gridster widget

本文关键字:UL 标签 小部 欺诈      更新时间:2023-09-26

我试图在gridster小部件中使用ul标记,但由于某些原因,列表无法正常工作。

请参阅下方的小提琴

http://jsfiddle.net/h9f63/237/

这是因为您在gridster内部启用了gridster。

在JavaScript的第5行,您选择欺诈程序中的所有ul标签,并将它们转换为子欺诈程序。您可以使用大于号将其更改为仅选择外部ul元素,如下所示:

    gridster = $(".gridster > ul").gridster({  //...

>符号的添加使选择器仅针对作为.gridster的直接后代的一个ul,而不是其中包含的所有ul

同样,你的CSS也需要同样的修复:

.gridster > ul {
    list-style: none;
    background-color: gray;
}
.gridster > ul li {
    background-color: white;
}

试试这些变化,效果会更好。