Search code examples
dynamicslidersencha-touch

Change width of thumb of a slider dynamically in Sencha Touch


I need to change the width of a thumb of a slider dynamically. Sencha's CSS is not letting me. Only if I call .x-thumb::before in my CSS I can set it there, but I need to do it in my Javascript code since the width will vary depending on the number of elements I need to slide.

I have tried changing the width in the DOM but nothing happens, it seems that the property gets overwritten by Sencha's CSS.

Any help is greatly appreciated.


Solution

  • You may want to try setting the 'style' attribute of the DOM element.

    Ext.select('#my-element-id').elements[0].style.width = '100px'