开发者

Is it possible to do a logical AND in this jquery code?

开发者 https://www.devze.com 2023-03-26 00:25 出处:网络
here\'s a question for the logically endowed. I\'m using isotope, a badass jquery mozaic tool that does, among other awesome things, animated filtering of data via code like this ...

here's a question for the logically endowed. I'm using isotope, a badass jquery mozaic tool that does, among other awesome things, animated filtering of data via code like this ...

    $('#container').isotope({ filter: '.metal' });

You can also do an AND for multiple selectors ...

    $('#container').isotope({ filter: '.alkali, .alkaline-earth' });

... where anything with class alkali OR class alkaline-earth are selected.

I'm looking for a way to filter the "logical AND" (aka "logical conjunction"), showing ONLY elements where BOTH alkalai AND alkaline-earth classes exist.

I found this stackoverflow answer ... How do I combine logical OR with logical AND within a jQuery attribute selector? ... but isotope probably ne开发者_开发问答eds something more specific in the filter parameter.

Any ideas?


What about:

$('#container').isotope({ filter: '.alkali.alkaline-earth' });

That's the common way to select elements that have both class names defined.

0

精彩评论

暂无评论...
验证码 换一张
取 消