Slider with multiple handles and predefined values : Slider « Scriptaculous « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript DHTML » Scriptaculous » Slider 
Slider with multiple handles and predefined values
 
<!--
Copyright (c2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<!-- revised from scriptaculous-js-1.8.2 demo code  -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
    <title>Text effects tests</title>
    <script type="text/javascript" src="scriptaculous-js-1.8.2/lib/prototype.js"></script> 
    <script type="text/javascript" src="scriptaculous-js-1.8.2/src/scriptaculous.js"></script>
</head>    
<body>

  <h1>Sliders</h1>
  
  <h2>Standard horizontal slider</h2>
  
  <div id="track1" style="width:200px;background-color:#aaa;height:5px;">
    <div id="handle1" style="width:5px;height:10px;background-color:#f00;"> </div>
  </div>
  
  <p id="debug1"> </p>
  
  <h2>Vertical slider</h2>
  
  <div id="track2" style="height:100px;background-color:#aaa;width:5px;">
    <div id="handle2" style="width:10px;height:5px;background-color:#f00;"> </div>
  </div>
  
  <p id="debug2"> </p>
  
  <h2>Slider with predefined values [2,4,6,8and a non-default range [2,15]</h2>
  
  <div id="track3" style="width:200px;background-color:#aaa;height:5px;">
    <div id="handle3" style="width:5px;height:10px;background-color:#f00;"> </div>
  </div>
  
  <p id="debug3"> </p>
  
  <h2>Slider with multiple handles</h2>
  
  <div id="track4" style="width:200px;background-color:#aaa;height:5px;position:relative;">
    <div id="handle4-1" style="position:absolute;top:0;left:0;width:5px;height:10px;background-color:#f00;"> </div>
    <div id="handle4-2" style="position:absolute;top:0;left:0;width:5px;height:10px;background-color:#0f0;"> </div>
    <div id="handle4-3" style="position:absolute;top:0;left:0;width:5px;height:10px;background-color:#00f;"> </div>
  </div>
  
  <p id="debug4"> </p>
  
  <h2>Slider with multiple handles and predefined values</h2>
  
  <div id="track5" style="width:200px;background-color:#aaa;height:5px;position:relative;">
    <div id="handle5-1" style="opacity:0.5;position:absolute;top:0;left:0;width:5px;height:10px;background-color:#f00;"> </div>
    <div id="handle5-2" style="opacity:0.5;position:absolute;top:0;left:0;width:5px;height:10px;background-color:#0f0;"> </div>
    <div id="handle5-3" style="opacity:0.5;position:absolute;top:0;left:0;width:5px;height:10px;background-color:#00f;"> </div>
  </div>
  
  <p id="debug5"> </p>
  
  <h2>Slider with multiple handles, external controls, handles are restricted (can't be moved prior/after adjacent handles)</h2>
  
  <div id="track6" style="width:200px;background-color:#aaa;height:5px;position:relative;">
    <div id="handle6-1" style="position:absolute;top:0;left:0;width:5px;height:10px;background-color:#f00;"> </div>
    <div id="handle6-2" style="position:absolute;top:0;left:0;width:5px;height:10px;background-color:#0f0;"> </div>
  </div>
  
  <br/><br/>
  <a href="#" onclick="slider6.setValueBy(-0.1);return false;">&lt;--</a>
  <a href="#" onclick="slider6.setValueBy(0.1);return false;">--&gt;</a>
  
  <p id="debug6"> </p>
  
  <h2>Fun with spans</h2>
  
  <style>
    #track7 div.handle {
      background-color:#aaa;
      color:#444;
      top:0;
      left:0;
      position:absolute;
      z-index:2;
      height:100px;
      font-size:20px;
    }
    #track7 div.handle.selected {
      background-color:#444;
      color:#fff;
    }
  </style>
  
  <div id="track7" style="width:300px;background-color:#cbf;height:50px;position:relative;z-index:0;">
    <div id="handle7-1" class="handle">1</div>
    <div id="handle7-2" class="handle">2</div>
    <div id="handle7-3" class="handle">3</div>

    <div id="span7-1" style="top:0;left:0;position:absolute;background-color:#000;height:50px;z-index:1;"> </div>
    <div id="span7-2" style="top:0;left:0;position:absolute;background-color:#444;height:50px;z-index:1;"> </div>

    <div id="span7-start" style="top:0;left:0;position:absolute;background-color:#f00;height:50px;z-index:1;"> </div>
    <div id="span7-end" style="top:0;left:0;position:absolute;background-color:#00f;height:50px;z-index:1;"> </div>
  </div>
  
  <br/><br/><br/><br/>
  
  <h2>Slider with span and [1,10range (test for #3731)</h2>
  
  <div id="zoom-track" style="width:300px;background-color:#aaa;height:20px;position:relative;z-index:0;">
    <div id="zoom-handle-1" style="position:absolute;background-color:#f00;height:20px;z-index:2">!</div>
    <div id="zoom-handle-2" style="position:absolute;background-color:#0f0;height:20px;z-index:2">!</div>
    <div id="zoom-track-selected" style="position:absolute;background-color:#00f;height:20px;z-index:1"> </div>
  </div>
  
  
  <!-- FIXME: add more demos here -->
  
  <script type="text/javascript">
  
    new Control.Slider('handle1','track1',{
      sliderValue:0.5,
      onSlide:function(v){$('debug1').innerHTML='slide: '+v},
      onChange:function(v){$('debug1').innerHTML='changed! '+v}});
    new Control.Slider('handle2','track2',{axis:'vertical',
        onSlide:function(v){$('debug2').innerHTML='slide: '+v},
        onChange:function(v){$('debug2').innerHTML='changed! '+v}});
    new Control.Slider('handle3','track3',{values:[2,4,6,8],range:$R(2,15),
        onSlide:function(v){$('debug3').innerHTML='slide: '+v},
        onChange:function(v){$('debug3').innerHTML='changed! '+v}});
    new Control.Slider(['handle4-1','handle4-2','handle4-3'],'track4',{
        onSlide:function(v){$('debug4').innerHTML='slide: '+v.inspect()},
        onChange:function(v){$('debug4').innerHTML='changed! '+v.inspect()}});
    new Control.Slider(['handle5-1','handle5-2','handle5-3'],'track5',{values:[0,0.2,0.4,0.6,0.8],
        onSlide:function(v){$('debug5').innerHTML='slide: '+v.inspect()},
        onChange:function(v){$('debug5').innerHTML='changed! '+v.inspect()}});
    var slider6 = new Control.Slider(['handle6-1','handle6-2'],'track6',{
        sliderValue:[0.30.8],
        restricted:true,
        onSlide:function(v){$('debug6').innerHTML='slide: '+v.inspect()},
        onChange:function(v){$('debug6').innerHTML='changed! '+v.inspect()}});
    new Control.Slider(['handle7-1','handle7-2','handle7-3'], 'track7',
        spans:['span7-1','span7-2'],
          startSpan:'span7-start',
          endSpan:'span7-end',
          range:$R(0,300) });
    new Control.Slider(
      ['zoom-handle-1','zoom-handle-2'],'zoom-track',{
        sliderValue:[1,10], range:$R(1,10),
        values:[1,2,3,4,5,6,7,8,9,10],
        restricted:true,
        spans:['zoom-track-selected'] });
  
  </script>
  
</body>
</html>

   
  
Related examples in the same category
1. Vertical slider, standard slider
2. Slider with preset value
3. Slider with multiple handles
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.