rguliev / conditionize2.js

jQuery plugin for conditioning things
https://rguliev.github.io/conditionize2.js/demo/index.html
MIT License
22 stars 6 forks source link

Feature request: option to hide/show elements using a css class #13

Closed Seb33300 closed 3 years ago

Seb33300 commented 3 years ago

Hello,

This plugin is using inline CSS style display: none; to hide elements.

Nowadays, most of project are using a CSS framework like Bootstrap. Bootstrap 5 provide the CSS class d-none to hide an element> I would like to tell this plugin to use d-none class to hide an element instead of display: none; inline CSS.

This may set thanks to a new option.

Thank you

Seb33300 commented 3 years ago

I should have read the documentation more in details...

This is already possible using ifTrue and ifFalse:

$('...').conditionize({
    ifTrue: function ($s) { $s.removeClass('d-none'); },
    ifFalse: function ($s) { $s.addClass('d-none'); }
});