Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added callbacks and new iconClass parameter. #46

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

objectivehtml
Copy link

  • Added two new callbacks, init() & changed()
  • Added new option "iconClass", which will add another nested span tag with the defined classname. This makes working with icon fonts easier (like Font Awesome).

- Added new option "iconClass", which will add another nested span tag with the defined classname. This makes working with icon fonts easier (like Font Awesome).
…sition elements further in the dom (also without zIndex's defined)
@adamcoulombe
Copy link
Owner

@objectivehtml I'm curious what the preferred method would be to populate the icon into the new span? Do you just use :before ? And if so, why do you need an addition span to do so?

@objectivehtml
Copy link
Author

I have all this working already. I need to recommit my changes so you can see all the stuff I did. I made a pull request, and then decided to refactor my work a bit. I think with these new callback methods and new params for the icon node, it works great.

I use Font Awesome for my icons. So I typically do something like this:

<i class="icon-search"></i>

or

<span class="icon-search"></span>

So with your plugin, I just added a param to append a new icon node and I could apply any class to it. I bet there were other ways to do it, but this was easiest/quickest for me to implement.

@objectivehtml
Copy link
Author

I just pushed my latest changes.

Here is a basic usage example:

(function($) {
    $(document).ready(function() {
        $('.custom-select').customSelect({
            iconClass: 'icon-sort-down'
        });
    });
}(jQuery));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants