gpt4 book ai didi

javascript - 同位素 Metafizzy : How to check if an element has already been initialized as an isotope container?

转载 作者:搜寻专家 更新时间:2023-11-01 04:43:51 24 4
gpt4 key购买 nike

插件:http://isotope.metafizzy.co/

我希望能够检查一个元素是否已经被初始化为同位素容器。 EG 如果元素没有,则以下代码将导致错误消息:

 $(".div-class").isotope('destroy')

产量:

 cannot call methods on isotope prior to initialization; attempted to call method 'destroy'

我希望能够写出这样的东西:

 if ($(".div-class").isotope('already-initialized')) {
// some other code
}

我在同位素文档上找不到这样的方法。任何帮助将不胜感激!

最佳答案

该类不再由同位素添加。我是这样解决的:

if($(".div-class").data('isotope')) {

}

关于javascript - 同位素 Metafizzy : How to check if an element has already been initialized as an isotope container?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16138404/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com