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

close keyboard is it open after certain time #612

Closed
almih2m opened this issue Oct 22, 2017 · 5 comments
Closed

close keyboard is it open after certain time #612

almih2m opened this issue Oct 22, 2017 · 5 comments

Comments

@almih2m
Copy link

almih2m commented Oct 22, 2017

I try to close the keyboard if the user does not close the screen in a certain time
is there any way to close it? by using code

also when I load screen on the old screen and the keyboard is open. the keyboard stay open on loaded screen .is there any way to solve that problem?

Thank you

@Mottie
Copy link
Owner

Mottie commented Oct 22, 2017

Hi @almih2m!

You can use a combination of Events and methods to close the keyboard if there is no activity after a certain amount of time.

In this example, the timer is set to 3 seconds

$(function() {
  var closeTimer,
    timeUntilClose = 3000; // 3 seconds

  function updateTimer(e, kb) {
    clearTimeout(closeTimer);
    closeTimer = setTimeout(function() {
      kb.close(kb.options.autoAccept);
    }, timeUntilClose);
  }

  $("#keyboard").keyboard({
    // keep any changes
    autoAccept: true,
    visible: updateTimer,
    change: updateTimer,
    beforeClose: updateTimer
  });
});

also when I load screen on the old screen and the keyboard is open. the keyboard stay open on loaded screen

I'm not really sure what you mean by that... is the keyboard set to be alwaysOpen? Then the above code won't work.

@almih2m
Copy link
Author

almih2m commented Oct 23, 2017

I make timer to load page if user does not click on anything on screen

but when new page load over the old page and the keyboard was open, the keyboard not hide and freezes the screen

maybe the problem on
.ui-keyboard-has-focus {
z-index: 16001;
}

???

@almih2m
Copy link
Author

almih2m commented Oct 23, 2017

Another thing, I have visible as a function
how I can call updateTimer function?
visible: function () {
..........
........
.........

    },

Thank you a lot for your help

@Mottie
Copy link
Owner

Mottie commented Oct 23, 2017

but when new page load over the old page and the keyboard was open, the keyboard not hide and freezes the screen

I'm still not sure what you mean. Please share the code for the timer you're using. The css to increase the z-index is not the cause of this problem.

how I can call updateTimer function?

Follow this example:

$("#keyboard").keyboard({
  // keep any changes
  autoAccept: true,
  visible: function(e, kb) {
    // ...
    updateTimer(e, kb);
  },
  change: updateTimer,
  beforeClose: updateTimer
});

@Mottie
Copy link
Owner

Mottie commented Nov 23, 2017

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants