Нет описания

slider.js 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. /*!
  2. * jQuery UI Slider 1.12.1
  3. * http://jqueryui.com
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. */
  9. //>>label: Slider
  10. //>>group: Widgets
  11. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  12. //>>docs: http://api.jqueryui.com/slider/
  13. //>>demos: http://jqueryui.com/slider/
  14. //>>css.structure: ../../themes/base/core.css
  15. //>>css.structure: ../../themes/base/slider.css
  16. //>>css.theme: ../../themes/base/theme.css
  17. ( function( factory ) {
  18. if ( typeof define === "function" && define.amd ) {
  19. // AMD. Register as an anonymous module.
  20. define( [
  21. "jquery",
  22. "./mouse",
  23. "./core"
  24. ], factory );
  25. } else {
  26. // Browser globals
  27. factory( jQuery );
  28. }
  29. }( function( $ ) {
  30. return $.widget( "ui.slider", $.ui.mouse, {
  31. version: "1.12.1",
  32. widgetEventPrefix: "slide",
  33. options: {
  34. animate: false,
  35. classes: {
  36. "ui-slider": "ui-corner-all",
  37. "ui-slider-handle": "ui-corner-all",
  38. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  39. // element, but worked best visually with a variety of themes
  40. "ui-slider-range": "ui-corner-all ui-widget-header"
  41. },
  42. distance: 0,
  43. max: 100,
  44. min: 0,
  45. orientation: "horizontal",
  46. range: false,
  47. step: 1,
  48. value: 0,
  49. values: null,
  50. // Callbacks
  51. change: null,
  52. slide: null,
  53. start: null,
  54. stop: null
  55. },
  56. // Number of pages in a slider
  57. // (how many times can you page up/down to go through the whole range)
  58. numPages: 5,
  59. _create: function() {
  60. this._keySliding = false;
  61. this._mouseSliding = false;
  62. this._animateOff = true;
  63. this._handleIndex = null;
  64. this._detectOrientation();
  65. this._mouseInit();
  66. this._calculateNewMax();
  67. this._addClass( "ui-slider ui-slider-" + this.orientation,
  68. "ui-widget ui-widget-content" );
  69. this._refresh();
  70. this._animateOff = false;
  71. },
  72. _refresh: function() {
  73. this._createRange();
  74. this._createHandles();
  75. this._setupEvents();
  76. this._refreshValue();
  77. },
  78. _createHandles: function() {
  79. var i, handleCount,
  80. options = this.options,
  81. existingHandles = this.element.find( ".ui-slider-handle" ),
  82. handle = "<span tabindex='0'></span>",
  83. handles = [];
  84. handleCount = ( options.values && options.values.length ) || 1;
  85. if ( existingHandles.length > handleCount ) {
  86. existingHandles.slice( handleCount ).remove();
  87. existingHandles = existingHandles.slice( 0, handleCount );
  88. }
  89. for ( i = existingHandles.length; i < handleCount; i++ ) {
  90. handles.push( handle );
  91. }
  92. this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  93. this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  94. this.handle = this.handles.eq( 0 );
  95. this.handles.each( function( i ) {
  96. $( this )
  97. .data( "ui-slider-handle-index", i )
  98. .attr( "tabIndex", 0 );
  99. } );
  100. },
  101. _createRange: function() {
  102. var options = this.options;
  103. if ( options.range ) {
  104. if ( options.range === true ) {
  105. if ( !options.values ) {
  106. options.values = [ this._valueMin(), this._valueMin() ];
  107. } else if ( options.values.length && options.values.length !== 2 ) {
  108. options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  109. } else if ( $.isArray( options.values ) ) {
  110. options.values = options.values.slice( 0 );
  111. }
  112. }
  113. if ( !this.range || !this.range.length ) {
  114. this.range = $( "<div>" )
  115. .appendTo( this.element );
  116. this._addClass( this.range, "ui-slider-range" );
  117. } else {
  118. this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  119. // Handle range switching from true to min/max
  120. this.range.css( {
  121. "left": "",
  122. "bottom": ""
  123. } );
  124. }
  125. if ( options.range === "min" || options.range === "max" ) {
  126. this._addClass( this.range, "ui-slider-range-" + options.range );
  127. }
  128. } else {
  129. if ( this.range ) {
  130. this.range.remove();
  131. }
  132. this.range = null;
  133. }
  134. },
  135. _setupEvents: function() {
  136. this._off( this.handles );
  137. this._on( this.handles, this._handleEvents );
  138. this._hoverable( this.handles );
  139. this._focusable( this.handles );
  140. },
  141. _destroy: function() {
  142. this.handles.remove();
  143. if ( this.range ) {
  144. this.range.remove();
  145. }
  146. this._mouseDestroy();
  147. },
  148. _mouseCapture: function( event ) {
  149. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  150. that = this,
  151. o = this.options;
  152. if ( o.disabled ) {
  153. return false;
  154. }
  155. this.elementSize = {
  156. width: this.element.outerWidth(),
  157. height: this.element.outerHeight()
  158. };
  159. this.elementOffset = this.element.offset();
  160. position = { x: event.pageX, y: event.pageY };
  161. normValue = this._normValueFromMouse( position );
  162. distance = this._valueMax() - this._valueMin() + 1;
  163. this.handles.each( function( i ) {
  164. var thisDistance = Math.abs( normValue - that.values( i ) );
  165. if ( ( distance > thisDistance ) ||
  166. ( distance === thisDistance &&
  167. ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  168. distance = thisDistance;
  169. closestHandle = $( this );
  170. index = i;
  171. }
  172. } );
  173. allowed = this._start( event, index );
  174. if ( allowed === false ) {
  175. return false;
  176. }
  177. this._mouseSliding = true;
  178. this._handleIndex = index;
  179. this._addClass( closestHandle, null, "ui-state-active" );
  180. closestHandle.trigger( "focus" );
  181. offset = closestHandle.offset();
  182. mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  183. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  184. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  185. top: event.pageY - offset.top -
  186. ( closestHandle.height() / 2 ) -
  187. ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  188. ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  189. ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  190. };
  191. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  192. this._slide( event, index, normValue );
  193. }
  194. this._animateOff = true;
  195. return true;
  196. },
  197. _mouseStart: function() {
  198. return true;
  199. },
  200. _mouseDrag: function( event ) {
  201. var position = { x: event.pageX, y: event.pageY },
  202. normValue = this._normValueFromMouse( position );
  203. this._slide( event, this._handleIndex, normValue );
  204. return false;
  205. },
  206. _mouseStop: function( event ) {
  207. this._removeClass( this.handles, null, "ui-state-active" );
  208. this._mouseSliding = false;
  209. this._stop( event, this._handleIndex );
  210. this._change( event, this._handleIndex );
  211. this._handleIndex = null;
  212. this._clickOffset = null;
  213. this._animateOff = false;
  214. return false;
  215. },
  216. _detectOrientation: function() {
  217. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  218. },
  219. _normValueFromMouse: function( position ) {
  220. var pixelTotal,
  221. pixelMouse,
  222. percentMouse,
  223. valueTotal,
  224. valueMouse;
  225. if ( this.orientation === "horizontal" ) {
  226. pixelTotal = this.elementSize.width;
  227. pixelMouse = position.x - this.elementOffset.left -
  228. ( this._clickOffset ? this._clickOffset.left : 0 );
  229. } else {
  230. pixelTotal = this.elementSize.height;
  231. pixelMouse = position.y - this.elementOffset.top -
  232. ( this._clickOffset ? this._clickOffset.top : 0 );
  233. }
  234. percentMouse = ( pixelMouse / pixelTotal );
  235. if ( percentMouse > 1 ) {
  236. percentMouse = 1;
  237. }
  238. if ( percentMouse < 0 ) {
  239. percentMouse = 0;
  240. }
  241. if ( this.orientation === "vertical" ) {
  242. percentMouse = 1 - percentMouse;
  243. }
  244. valueTotal = this._valueMax() - this._valueMin();
  245. valueMouse = this._valueMin() + percentMouse * valueTotal;
  246. return this._trimAlignValue( valueMouse );
  247. },
  248. _uiHash: function( index, value, values ) {
  249. var uiHash = {
  250. handle: this.handles[ index ],
  251. handleIndex: index,
  252. value: value !== undefined ? value : this.value()
  253. };
  254. if ( this._hasMultipleValues() ) {
  255. uiHash.value = value !== undefined ? value : this.values( index );
  256. uiHash.values = values || this.values();
  257. }
  258. return uiHash;
  259. },
  260. _hasMultipleValues: function() {
  261. return this.options.values && this.options.values.length;
  262. },
  263. _start: function( event, index ) {
  264. return this._trigger( "start", event, this._uiHash( index ) );
  265. },
  266. _slide: function( event, index, newVal ) {
  267. var allowed, otherVal,
  268. currentValue = this.value(),
  269. newValues = this.values();
  270. if ( this._hasMultipleValues() ) {
  271. otherVal = this.values( index ? 0 : 1 );
  272. currentValue = this.values( index );
  273. if ( this.options.values.length === 2 && this.options.range === true ) {
  274. newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  275. }
  276. newValues[ index ] = newVal;
  277. }
  278. if ( newVal === currentValue ) {
  279. return;
  280. }
  281. allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  282. // A slide can be canceled by returning false from the slide callback
  283. if ( allowed === false ) {
  284. return;
  285. }
  286. if ( this._hasMultipleValues() ) {
  287. this.values( index, newVal );
  288. } else {
  289. this.value( newVal );
  290. }
  291. },
  292. _stop: function( event, index ) {
  293. this._trigger( "stop", event, this._uiHash( index ) );
  294. },
  295. _change: function( event, index ) {
  296. if ( !this._keySliding && !this._mouseSliding ) {
  297. //store the last changed value index for reference when handles overlap
  298. this._lastChangedValue = index;
  299. this._trigger( "change", event, this._uiHash( index ) );
  300. }
  301. },
  302. value: function( newValue ) {
  303. if ( arguments.length ) {
  304. this.options.value = this._trimAlignValue( newValue );
  305. this._refreshValue();
  306. this._change( null, 0 );
  307. return;
  308. }
  309. return this._value();
  310. },
  311. values: function( index, newValue ) {
  312. var vals,
  313. newValues,
  314. i;
  315. if ( arguments.length > 1 ) {
  316. this.options.values[ index ] = this._trimAlignValue( newValue );
  317. this._refreshValue();
  318. this._change( null, index );
  319. return;
  320. }
  321. if ( arguments.length ) {
  322. if ( $.isArray( arguments[ 0 ] ) ) {
  323. vals = this.options.values;
  324. newValues = arguments[ 0 ];
  325. for ( i = 0; i < vals.length; i += 1 ) {
  326. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  327. this._change( null, i );
  328. }
  329. this._refreshValue();
  330. } else {
  331. if ( this._hasMultipleValues() ) {
  332. return this._values( index );
  333. } else {
  334. return this.value();
  335. }
  336. }
  337. } else {
  338. return this._values();
  339. }
  340. },
  341. _setOption: function( key, value ) {
  342. var i,
  343. valsLength = 0;
  344. if ( key === "range" && this.options.range === true ) {
  345. if ( value === "min" ) {
  346. this.options.value = this._values( 0 );
  347. this.options.values = null;
  348. } else if ( value === "max" ) {
  349. this.options.value = this._values( this.options.values.length - 1 );
  350. this.options.values = null;
  351. }
  352. }
  353. if ( $.isArray( this.options.values ) ) {
  354. valsLength = this.options.values.length;
  355. }
  356. this._super( key, value );
  357. switch ( key ) {
  358. case "orientation":
  359. this._detectOrientation();
  360. this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  361. ._addClass( "ui-slider-" + this.orientation );
  362. this._refreshValue();
  363. if ( this.options.range ) {
  364. this._refreshRange( value );
  365. }
  366. // Reset positioning from previous orientation
  367. this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  368. break;
  369. case "value":
  370. this._animateOff = true;
  371. this._refreshValue();
  372. this._change( null, 0 );
  373. this._animateOff = false;
  374. break;
  375. case "values":
  376. this._animateOff = true;
  377. this._refreshValue();
  378. // Start from the last handle to prevent unreachable handles (#9046)
  379. for ( i = valsLength - 1; i >= 0; i-- ) {
  380. this._change( null, i );
  381. }
  382. this._animateOff = false;
  383. break;
  384. case "step":
  385. case "min":
  386. case "max":
  387. this._animateOff = true;
  388. this._calculateNewMax();
  389. this._refreshValue();
  390. this._animateOff = false;
  391. break;
  392. case "range":
  393. this._animateOff = true;
  394. this._refresh();
  395. this._animateOff = false;
  396. break;
  397. }
  398. },
  399. _setOptionDisabled: function( value ) {
  400. this._super( value );
  401. this._toggleClass( null, "ui-state-disabled", !!value );
  402. },
  403. //internal value getter
  404. // _value() returns value trimmed by min and max, aligned by step
  405. _value: function() {
  406. var val = this.options.value;
  407. val = this._trimAlignValue( val );
  408. return val;
  409. },
  410. //internal values getter
  411. // _values() returns array of values trimmed by min and max, aligned by step
  412. // _values( index ) returns single value trimmed by min and max, aligned by step
  413. _values: function( index ) {
  414. var val,
  415. vals,
  416. i;
  417. if ( arguments.length ) {
  418. val = this.options.values[ index ];
  419. val = this._trimAlignValue( val );
  420. return val;
  421. } else if ( this._hasMultipleValues() ) {
  422. // .slice() creates a copy of the array
  423. // this copy gets trimmed by min and max and then returned
  424. vals = this.options.values.slice();
  425. for ( i = 0; i < vals.length; i += 1 ) {
  426. vals[ i ] = this._trimAlignValue( vals[ i ] );
  427. }
  428. return vals;
  429. } else {
  430. return [];
  431. }
  432. },
  433. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  434. _trimAlignValue: function( val ) {
  435. if ( val <= this._valueMin() ) {
  436. return this._valueMin();
  437. }
  438. if ( val >= this._valueMax() ) {
  439. return this._valueMax();
  440. }
  441. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  442. valModStep = ( val - this._valueMin() ) % step,
  443. alignValue = val - valModStep;
  444. if ( Math.abs( valModStep ) * 2 >= step ) {
  445. alignValue += ( valModStep > 0 ) ? step : ( -step );
  446. }
  447. // Since JavaScript has problems with large floats, round
  448. // the final value to 5 digits after the decimal point (see #4124)
  449. return parseFloat( alignValue.toFixed( 5 ) );
  450. },
  451. _calculateNewMax: function() {
  452. var max = this.options.max,
  453. min = this._valueMin(),
  454. step = this.options.step,
  455. aboveMin = Math.round( ( max - min ) / step ) * step;
  456. max = aboveMin + min;
  457. if ( max > this.options.max ) {
  458. //If max is not divisible by step, rounding off may increase its value
  459. max -= step;
  460. }
  461. this.max = parseFloat( max.toFixed( this._precision() ) );
  462. },
  463. _precision: function() {
  464. var precision = this._precisionOf( this.options.step );
  465. if ( this.options.min !== null ) {
  466. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  467. }
  468. return precision;
  469. },
  470. _precisionOf: function( num ) {
  471. var str = num.toString(),
  472. decimal = str.indexOf( "." );
  473. return decimal === -1 ? 0 : str.length - decimal - 1;
  474. },
  475. _valueMin: function() {
  476. return this.options.min;
  477. },
  478. _valueMax: function() {
  479. return this.max;
  480. },
  481. _refreshRange: function( orientation ) {
  482. if ( orientation === "vertical" ) {
  483. this.range.css( { "width": "", "left": "" } );
  484. }
  485. if ( orientation === "horizontal" ) {
  486. this.range.css( { "height": "", "bottom": "" } );
  487. }
  488. },
  489. _refreshValue: function() {
  490. var lastValPercent, valPercent, value, valueMin, valueMax,
  491. oRange = this.options.range,
  492. o = this.options,
  493. that = this,
  494. animate = ( !this._animateOff ) ? o.animate : false,
  495. _set = {};
  496. if ( this._hasMultipleValues() ) {
  497. this.handles.each( function( i ) {
  498. valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  499. that._valueMin() ) * 100;
  500. _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  501. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  502. if ( that.options.range === true ) {
  503. if ( that.orientation === "horizontal" ) {
  504. if ( i === 0 ) {
  505. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  506. left: valPercent + "%"
  507. }, o.animate );
  508. }
  509. if ( i === 1 ) {
  510. that.range[ animate ? "animate" : "css" ]( {
  511. width: ( valPercent - lastValPercent ) + "%"
  512. }, {
  513. queue: false,
  514. duration: o.animate
  515. } );
  516. }
  517. } else {
  518. if ( i === 0 ) {
  519. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  520. bottom: ( valPercent ) + "%"
  521. }, o.animate );
  522. }
  523. if ( i === 1 ) {
  524. that.range[ animate ? "animate" : "css" ]( {
  525. height: ( valPercent - lastValPercent ) + "%"
  526. }, {
  527. queue: false,
  528. duration: o.animate
  529. } );
  530. }
  531. }
  532. }
  533. lastValPercent = valPercent;
  534. } );
  535. } else {
  536. value = this.value();
  537. valueMin = this._valueMin();
  538. valueMax = this._valueMax();
  539. valPercent = ( valueMax !== valueMin ) ?
  540. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  541. 0;
  542. _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  543. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  544. if ( oRange === "min" && this.orientation === "horizontal" ) {
  545. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  546. width: valPercent + "%"
  547. }, o.animate );
  548. }
  549. if ( oRange === "max" && this.orientation === "horizontal" ) {
  550. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  551. width: ( 100 - valPercent ) + "%"
  552. }, o.animate );
  553. }
  554. if ( oRange === "min" && this.orientation === "vertical" ) {
  555. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  556. height: valPercent + "%"
  557. }, o.animate );
  558. }
  559. if ( oRange === "max" && this.orientation === "vertical" ) {
  560. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  561. height: ( 100 - valPercent ) + "%"
  562. }, o.animate );
  563. }
  564. }
  565. },
  566. _handleEvents: {
  567. keydown: function( event ) {
  568. var allowed, curVal, newVal, step,
  569. index = $( event.target ).data( "ui-slider-handle-index" );
  570. switch ( event.keyCode ) {
  571. case $.ui.keyCode.HOME:
  572. case $.ui.keyCode.END:
  573. case $.ui.keyCode.PAGE_UP:
  574. case $.ui.keyCode.PAGE_DOWN:
  575. case $.ui.keyCode.UP:
  576. case $.ui.keyCode.RIGHT:
  577. case $.ui.keyCode.DOWN:
  578. case $.ui.keyCode.LEFT:
  579. event.preventDefault();
  580. if ( !this._keySliding ) {
  581. this._keySliding = true;
  582. this._addClass( $( event.target ), null, "ui-state-active" );
  583. allowed = this._start( event, index );
  584. if ( allowed === false ) {
  585. return;
  586. }
  587. }
  588. break;
  589. }
  590. step = this.options.step;
  591. if ( this._hasMultipleValues() ) {
  592. curVal = newVal = this.values( index );
  593. } else {
  594. curVal = newVal = this.value();
  595. }
  596. switch ( event.keyCode ) {
  597. case $.ui.keyCode.HOME:
  598. newVal = this._valueMin();
  599. break;
  600. case $.ui.keyCode.END:
  601. newVal = this._valueMax();
  602. break;
  603. case $.ui.keyCode.PAGE_UP:
  604. newVal = this._trimAlignValue(
  605. curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  606. );
  607. break;
  608. case $.ui.keyCode.PAGE_DOWN:
  609. newVal = this._trimAlignValue(
  610. curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  611. break;
  612. case $.ui.keyCode.UP:
  613. case $.ui.keyCode.RIGHT:
  614. if ( curVal === this._valueMax() ) {
  615. return;
  616. }
  617. newVal = this._trimAlignValue( curVal + step );
  618. break;
  619. case $.ui.keyCode.DOWN:
  620. case $.ui.keyCode.LEFT:
  621. if ( curVal === this._valueMin() ) {
  622. return;
  623. }
  624. newVal = this._trimAlignValue( curVal - step );
  625. break;
  626. }
  627. this._slide( event, index, newVal );
  628. },
  629. keyup: function( event ) {
  630. var index = $( event.target ).data( "ui-slider-handle-index" );
  631. if ( this._keySliding ) {
  632. this._keySliding = false;
  633. this._stop( event, index );
  634. this._change( event, index );
  635. this._removeClass( $( event.target ), null, "ui-state-active" );
  636. }
  637. }
  638. }
  639. } );
  640. } ) );