Skip to content Skip to sidebar Skip to footer

Jkey Jquery Plugin Errors In Ie6/7, Attempting To Run Whenever Any Un-used Key Is Pressed. How To Combat?

I'm using the jKey jQuery plugin on a current project. It just allows you to easily run a function on a key press. Here's my function call: jQuery(document).jkey('left, right',func

Solution 1:

Actually it's bug of jKey itself. I've found this bug, when tried to use at the project. That was classic problem with looping through array as object:

line 224: for(y in keySplit[x]) at GitHub revision

The solution is to traverse array as traditional loop:

for(var i = 0; i < keySplit.length; ++i)

So u can do it manually or get fixed version of 'jquery.jkey.js' from my Google Code revision

Solution 2:

Instead of just using else condition check for key == 'right' as well that might help you.

jQuery(document).jkey('left, right',function(key){
    if(key == 'left'){
        if (elementIndex == 0) { return; }
        question_nav(jQuery('.question-fieldset-active'), 'prev');
    } elseif(key == 'right') {
        if ((elementIndex + 1) == jQuery('.question-fieldset').length) { return; }
        question_nav(jQuery('.question-fieldset-active'), 'next');
    }
});

Post a Comment for "Jkey Jquery Plugin Errors In Ie6/7, Attempting To Run Whenever Any Un-used Key Is Pressed. How To Combat?"