Skip to content

Commit

Permalink
improved pagy-compact.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 10, 2018
1 parent 8c20fa2 commit 42ba053
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/pagy/extras/javascripts/pagy-compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ function PagyCompact(id, marker, page){
}
};

// jump to page number from input when input looses focus
input.addEventListener('focusout', this.go)
// … and when pressing enter inside input
input.addEventListener('keyup', function (e) {
if (event.which === 13) {
this.go()
}
}.bind(this))
// select the content on click: easier for typing a number
input.addEventListener('click', function(){ this.select() });
// jump to page number from input when the input looses focus
input.addEventListener('focusout', this.go);
// … and when pressing enter inside the input
input.addEventListener('keyup', function(e){ if (e.which === 13) this.go() }.bind(this));

}

0 comments on commit 42ba053

Please sign in to comment.