Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Spinner Width

I use the jQuery UI spinner in my pages which are now required to be responsive, thus presenting the challenge of adjusting the width of my jQuery UI spinners dynamically.

Does anyone know of any way to do this?

HTML

<input type="text" id="myspinner" style="width: 50px" />

JavaScript

$(function(){ 
    $("#myspinner").spinner(); 
});
like image 800
Jimbo Avatar asked Jan 03 '14 14:01

Jimbo


1 Answers

SOLVED

Sorry, I was being a bit retarded and looking for a jQuery way around this problem but have since realized that I could have just adjusted the original input box's CSS width to achieve the desired effect as below

@media screen and (max-width: 1000px) and (min-width: 480px) {
    #myspinner{
        width: 30px;
    }
}

or if you'd rather use jQuery

$("#myspinner").width(30);

Once this is called, the jQuery UI widget automatically resizes around the input box

like image 178
Jimbo Avatar answered Oct 21 '22 03:10

Jimbo