admin管理员组

文章数量:1192921

The plugin: /

I would like to be able to check if an element has already been initialized as an isotope container. EG the follow code will result in an error message if the element has not:

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

Yields:

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

I would like to be able to write something like:

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

I can't find such a method on isotope docs yet. Any help would be appreciated!

The plugin: http://isotope.metafizzy.co/

I would like to be able to check if an element has already been initialized as an isotope container. EG the follow code will result in an error message if the element has not:

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

Yields:

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

I would like to be able to write something like:

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

I can't find such a method on isotope docs yet. Any help would be appreciated!

Share Improve this question asked Apr 22, 2013 at 2:08 jayjay 12.5k16 gold badges66 silver badges104 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 25

That class is no longer added by isotope. I solved it like this:

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

}

Since I notice this plugin would add a isotope class to the container, you can try this code:

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

本文标签: