views:

370

answers:

3
<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
    <link href="http://localhost/test/styles/jquery/ui/skins/redmond/jquery-ui-1.7.2.custom.css" media="screen" rel="stylesheet" type="text/css" />

    <style type="text/css">
        #demo-frame > div.demo { padding: 10px !important; };
    </style>

    <script type="text/javascript">
      $(function() {
        $(".slider-range").slider({
            range: true,
            min: 0,
            max: 24

        });
      });
    </script>

</head>
<body>

    <div class="demo">
        <p>
            <label for="amount">Time range:</label>
            <input type="text" id="amount1" style="border:0; color:#f6931f; font-weight:bold;" value="" />
            <input type="text" id="amount2" style="border:0; color:#f6931f; font-weight:bold;" value="" />
            <input type="text" id="amount3" style="border:0; color:#f6931f; font-weight:bold;" value="" />
        </p>

        <div id="slider-range1" class="slider-range"></div>
        <div id="slider-range2" class="slider-range"></div>
        <div id="slider-range3" class="slider-range"></div>

    </div>

        <script type="text/javascript">
        <?php for ($i=1; $i<=3;$i++) { ?>
            $("#slider-range" + <?php =$i?>).slider( 'values' : [5 , 20] )
        <?php } ?>
        </script>
</body>
</html>

I have above code but it is not point at 5 and 20 also the range is changed from 0-24 to 0-100 .. Please help me to solve this issue... instead of 5 and 20 .. my value coming from databasse....

Regards Nisanth

A: 

first of all, you need to right proper code :)

  • Always end a javascript line with ;
  • Read the documentation ! :-)

you are using

slider( 'values' : [5 , 20] )

and it should be

slider({ values : [5 , 20] })

balexandre
That works fine but the range changed from 0-24 to 0-100 ....also the css is missing between the to range... :(
Nisanth
for that answer, I don't think you understand the slidder completely!
balexandre
yes .. im new to this.. but i need to implement hour range from database ... if u don't mind please give me a sample code..thanks in advance
Nisanth
please edit your question with the detailed task you are trying to accomplish. You want 3 sliders for Hour, Min, Sec? You want 3 Hour Sliders?
balexandre
Actually my task is based on some users.. if there is 5 user i want 5 slider .. i need to show their working hours(shift) for example 2am-10am, 10am-7pm etc....
Nisanth
A: 

I've not used the slider, but see if this helps:

$(".selector").slider({ min: 5, max: 20 });
Sohnee
+1  A: 

Hi Nisanth,

just try

$("#slide1").slider('values', 0, 10);
$("#slide1").slider('values', 1, 20);

Hope that will help :)

viMaL