Wednesday, September 5, 2012

jumping of browser window when using cursor keys

Hello Guys,
           There is wired problem when using auto completer on page and try to use arrow key for navigation.. it simply jump the browser window.

To over come this problem just add the patch in controls.js

replace line 212 to 214 with

    if(this.index > 0) {this.index--;}
    else {
      this.index = this.entryCount-1;
      this.update.scrollTop = this.update.scrollHeight;
    }
    selection = this.getEntry(this.index);
    selection_top = selection.offsetTop;
    if(selection_top < this.update.scrollTop){
    this.update.scrollTop = this.update.scrollTop-selection.offsetHeight;
    }

replace line 217 to 220 with

    if(this.index < this.entryCount-1) {this.index++;}
    else {
      this.index = 0;
      this.update.scrollTop = 0;
    }
    selection = this.getEntry(this.index);
    selection_bottom = selection.offsetTop+selection.offsetHeight;
    if(selection_bottom > this.update.scrollTop+this.update.offsetHeight){
      this.update.scrollTop = this.update.scrollTop+selection.offsetHeight;
    }
  
add line after 297
  this.update.scrollTop = 0;

In short by replacing two functions markPrevious() & markNext() will fix our problem.

No comments:

Post a Comment