jQuery: The Write Less, Do More JavaScript Library

Changeset 5525

Show
Ignore:
Timestamp:
05/08/08 22:01:28 (3 days ago)
Author:
joern.zaefferer
Message:

ui.slider: fixed keyboard handling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.slider.js

    r5524 r5525  
    5959                    .bind('blur', function(e) { self.blur(this.firstChild); }) 
    6060                    .bind('keydown', function(e) { 
    61                         if(/(37|38|39|40)/.test(e.keyCode)) { 
    62                             self.moveTo({ 
    63                                 x: /(37|39)/.test(e.keyCode) ? (e.keyCode == 37 ? '-' : '+') + '=' + self.oneStep(1) : null, 
    64                                 y: /(38|40)/.test(e.keyCode) ? (e.keyCode == 38 ? '-' : '+') + '=' + self.oneStep(2) : null 
    65                             }, this.firstChild); 
    66                         } 
     61                        self.keydown(e.keyCode, this.firstChild) 
    6762                    }) 
    6863            ; 
     
    8479            this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle 
    8580            if(this.handle.length == 2 && this.options.range) this.createRange(); 
     81        }, 
     82         
     83        keydown: function(keyCode, handle) { 
     84            if(/(37|38|39|40)/.test(keyCode)) { 
     85                this.moveTo({ 
     86                    x: /(37|39)/.test(keyCode) ? (keyCode == 37 ? '-' : '+') + '=' + this.oneStep(1) : 0, 
     87                    y: /(38|40)/.test(keyCode) ? (keyCode == 38 ? '-' : '+') + '=' + this.oneStep(2) : 0 
     88                }, handle); 
     89            } 
    8690        }, 
    8791