potan
potan

Reputation: 63

Disabling DropKick.js for selected fields

DropKick makes select boxes beautiful but when they are multiselect or size defined select boxes, it acts same and they all become single selectbox. Is there any way to disable DropKick for selected fields?

For example, if class includes "nokick" then don't touch that field.

Upvotes: 1

Views: 1349

Answers (3)

Rudolf Ratusiński
Rudolf Ratusiński

Reputation: 1087

This question is quite old, but someone can search for an answer. I think that author was asking about 'not enabling' dropkick on some fields , rather than disabling them as everyone thinks (like "disable" atttribute).

If that's true, then:

In your applicaton dropkick probably is initalized by jQuery code (or similar):

$("select").dropkick();

Just add class "nokick" (as you wrote) to 'select' you wish to be omited by dropkick and change initialization to:

$("select").not('.nokick').dropkick();

Using that jQuery will take all select elements but not those with 'nokick' class. It's good to read documentation about that: http://api.jquery.com/not/

Upvotes: 2

saurav
saurav

Reputation: 3462

Hoping that by this time you have found the solution of your problem.

Actually i also had the same requirement of disabling the dropkick dropdowns on the fly.

So, the approach that I have taken is to add a class -"gd-disable" dynamically in the div tag that was created by dropkick framework over the Select tag.

.gd-disable{
opacity:0.4;
}

.gd-disable a{
cursor: no-drop !important;
}

And your div tag will look like this

<div style="display: block;" class="dk_container gd-disable dk_theme_default" id="dk_container_color" tabindex="4"> <!-- Interal Code --> </div>

For more reference you can see this example mentioned here

Upvotes: 1

Caio Vaccaro
Caio Vaccaro

Reputation: 56

Yes Dropkick is very good. But for multiselect boxes or other types you don't need to leave empty handed. Chosen.js is really good for that: http://harvesthq.github.io/chosen/

Good luck.

Upvotes: 0

Related Questions