ttkrpink
ttkrpink

Reputation: 109

jQuery Mobile: remove rangeslider label and make slider wider

The JQM rangeslider is too small on my phone app. So I decide to remove the two labels on both side. The display: none method only hide the labels but not release the space for a bigger rangeslider. How to make it wider? I tried the ui-slider-track, width=100%, but it did not work.

Thanks for any help.

<!DOCTYPE html>
<html>
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0,height=device-height,user-scalable=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<style type=text/css>

input.ui-input-text.ui-slider-input {
    display: none;
}

.ui-rangeslider .ui-rangeslider-sliders .ui-slider-track {
    background: red;
}

</style>
</head>
<body>
<div data-role="page" id="FrontPage">

    <div data-role="content">
    <div data-role="rangeslider" id="DateSlider">
        <label for="range-1a" id="label-1a">Rangeslider:</label>
        <input type="range" name="range-1a" id="range-1a" min="0" max="364" value="127" step="3">
        <label for="range-1b">Rangeslider:</label>
        <input type="range" name="range-1b" id="range-1b" min="1" max="365" value="253" step="3">
    </div>
    </div><!-- /content -->
</body>
</html>

Upvotes: 0

Views: 1310

Answers (2)

Nirmal Patel
Nirmal Patel

Reputation: 5168

You can adjust the left/right margins for

.ui-rangeslider .ui-rangeslider-sliders {
    margin-right: 0;
    margin-left: 0;
}

Sample jsFiddle: http://jsfiddle.net/nirmaljpatel/SvCD3/

Upvotes: 1

Dev
Dev

Reputation: 6786

ADD

.ui-rangeslider .ui-rangeslider-sliders{
 margin: 0px;   
}

JS Fiddle http://jsfiddle.net/devmgs/vY5R6/

Upvotes: 1

Related Questions