Skip to content

Add hover / blur callback events #262

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

Closed
wants to merge 3 commits into from

Conversation

Peinkillar
Copy link

Added hover and blur events to react on mouseover states.

Added hover and blur events to react on mouseover states.
@fnagel
Copy link
Owner

fnagel commented Aug 30, 2012

Can you give ma an example what this fixes exactly? Perhaps with a demo fiddle (see #61)?

@Peinkillar
Copy link
Author

It is not a fix but an enhancement. In my scenario in a selectmenu i have listed geometries which are drawn on a map like Google Maps for example. When you select an entry the correspondent geometry is selected but you will only notice which geometry it is when you have already selected one. With the suggested hover and blur event it would be possible to highlight these geometries on mouseover. I can imagine this would be helpful in several other cases or don't you think so? It would be only some lines of additional code.

@fnagel
Copy link
Owner

fnagel commented Aug 30, 2012

Ahh, ok thanks for the explanation. Seems legit to me.

Why do you use public methods to fire the callbacks?

@Peinkillar
Copy link
Author

What do you mean with public methods? The hover and blur methods are equivalent to your change or select methods. o you can declare the callback methods like this:

jQuery(this.featureSelect).selectmenu({
   ...,
  change: function () {},
  hover: function (e) {},
  blur: function (e) {}
});

@fnagel
Copy link
Owner

fnagel commented Sep 3, 2012

Functions without _ prefix are public. Please see: http://wiki.jqueryui.com/w/page/12138135/Widget%20factory

So your hover and blur functions could be called by using myElement.selectmenu("blur").Why should this be possible? Afaics your current implementation would do nothing expect firing the callback.

hint: try typing "m" when not in a textfield for textformatting options!

made hover() and blur() methods private and added check for null value in _hover()
@Peinkillar
Copy link
Author

The methods can be private of course but why aren't your change and select method? I added the check for null in _hover() too. Do you think it is ok now?

@fnagel
Copy link
Owner

fnagel commented Sep 5, 2012

You are aware I only maintain this plugin as its original developed by filament group? Since then a bunch of people contributed and the code is everything but ot straight forward and clean. I'm just a guy who puts lot of his free time in this to keep this working until the official version is released, see #140

Change is public because its triggers a change event on the original select. I guess.
Select is public because... good question. Should be private I guess. TODO

Perhaps we should add your callbacks inline, without extra functions as they are really small. What do you think?

Please update your branch!

and removed unneeded check for null because the element at the index
should actually be never null. otherwise it wouldn't be triggered
@fnagel
Copy link
Owner

fnagel commented Sep 21, 2012

You need to merge your branch with my selectmenu branch, than pushing your branch to GitHub again.

@fnagel
Copy link
Owner

fnagel commented Sep 21, 2012

Sorry for the late response. Vacation time :-)

@Peinkillar
Copy link
Author

I'm on vacation as well ;) I will do it when I am back.

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

Successfully merging this pull request may close these issues.

2 participants