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

FIX: Need to double click on get focus in order to open the select list #169

Open
Asscobara opened this issue May 7, 2017 · 1 comment

Comments

@Asscobara
Copy link

app.directive
(
'nyaFix',
[
'$timeout',
function ($timeout)
{
return function (scope, element, attrs)
{
var timeFromLostFocus = new Date();
$( "#" + element[0].id ).focusin
(
function()
{
$timeout
(
function()
{
var currectTime = new Date();
if( currectTime.getTime() - timeFromLostFocus.getTime() > 150)
$( "#" + element[0].id ).addClass('open');
},
100
);

					}
				);
				
				$( "#" + element[0].id ).focusout
				(
					function() 
					{
						timeFromLostFocus =  new Date();
					}
				);

				scope.$watch
				(
					attrs.ngModel,
					function()
					{
						$timeout
						(
							function()
							{
								$( "#"  + attrs.nyaFixSetFocusId ).focus();
							},
							250
						);		
					}	
				);
			};
		}
	]
);	
@Asscobara
Copy link
Author

Use in the HTML

  1. {{option.displayName}}

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

No branches or pull requests

1 participant