利用jquery实现坐标标尺滑动效果



61 240 81



特效描述:利用jquery实现 坐标标尺 滑动效果,利用jquery实现坐标标尺滑动效果

代码结构

1. 引入CSS

<link rel="stylesheet" href="./stylesheets/jslider.css" type="text/css">
<link rel="stylesheet" href="./stylesheets/jslider.blue.css" type="text/css">
<link rel="stylesheet" href="./stylesheets/jslider.plastic.css" type="text/css">
<link rel="stylesheet" href="./stylesheets/jslider.round.css" type="text/css">
<link rel="stylesheet" href="./stylesheets/jslider.round.plastic.css" type="text/css">
<link rel="stylesheet" href="./stylesheets/jslider.ie6.css" type="text/css" media="screen">
<link rel="stylesheet" href="./stylesheets/jslider.blue.ie6.css" type="text/css" media="screen">
<link rel="stylesheet" href="./stylesheets/jslider.plastic.ie6.css" type="text/css" media="screen">
<link rel="stylesheet" href="./stylesheets/jslider.round.ie6.css" type="text/css" media="screen">
<link rel="stylesheet" href="./stylesheets/jslider.round.plastic.ie6.css" type="text/css" media="screen">

2. 引入JS

<script type="text/javascript" src="./javascripts/jquery-1.4.2.js"></script>
<script type="text/javascript" src="./javascripts/jquery.dependClass.js"></script>
<script type="text/javascript" src="./javascripts/jquery.slider-min.js"></script>

3. HTML代码

  <div class="layout">
    <div class="layout-slider" style="width: 100%">
      Slider <span style="display: inline-block; width: 400px; padding: 0 5px;"><input id="Slider1" type="slider" name="price" value="30000.5;60000" /></span>  in string
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#Slider1").slider({ from: 1000, to: 100000, step: 500, smooth: true, round: 0, dimension: "&nbsp;$", skin: "plastic" });
    </script>
    <div class="layout-slider-settings">
<pre>{
  from: 5,
  to: 50,
  step: 2.5,
  round: 1,
  dimension: '&amp;nbsp;€'
}</pre>
    </div>
    <div class="layout-slider">
      <input id="SliderSingle" type="slider" name="price" value="20" />
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#SliderSingle").slider({ from: 5, to: 50, step: 2.5, round: 1, dimension: '&nbsp;€', skin: "round" });
    </script>
    <div class="layout-slider-settings">
<pre>{
  from: 5000,
  to: 150000,
  heterogeneity: ['50/50000'],
  step: 1000,
  dimension: '&amp;nbsp;$'
}</pre>
    </div>
    <div class="layout-slider">
      <input id="Slider2" type="slider" name="price" value="5000;50000" />
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#Slider2").slider({ from: 5000, to: 150000, heterogeneity: ['50/50000'], step: 1000, dimension: '&nbsp;$' });
    </script>
    <div class="layout-slider-settings">
<pre>{
  from: 0,
  to: 500,
  heterogeneity: ['50/100', '75/250'],
  scale: [0, '|', 50, '|' , '100', '|', 250, '|', 500],
  limits: false,
  step: 1,
  dimension: '&amp;nbsp;m&lt;small&gt;2&lt;/small&gt;'
}</pre>
    </div>
    <div class="layout-slider">
      <input id="Slider3" type="slider" name="area" value="25;75" />
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#Slider3").slider({ from: 0, to: 500, heterogeneity: ['50/100', '75/250'], scale: [0, '|', 50, '|', '100', '|', 250, '|', 500], limits: false, step: 1, dimension: '&nbsp;m<small>2</small>', skin: "round_plastic" });
    </script>
    <div class="layout-slider-settings">
<pre>{
  from: 1,
  to: 30,
  heterogeneity: ['50/5', '75/15'],
  scale: [1, '|', 3, '|', '5', '|', 15, '|', 30],
  limits: false,
  step: 1,
  dimension: '',
  skin: "blue"
}</pre>
    </div>
    <div class="layout-slider">
      <input id="Slider4" type="slider" name="area" value="2;10" />
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#Slider4").slider({ from: 1, to: 30, heterogeneity: ['50/5', '75/15'], scale: [1, '|', 3, '|', '5', '|', 15, '|', 30], limits: false, step: 1, dimension: '', skin: "blue", callback: function( value ){ console.dir( this ); } });
    </script>
    <div class="layout-slider-settings">
<pre>{
  from: 480,
  to: 1020,
  step: 15,
  dimension: '',
  scale: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00'],
  limits: false,
  calculate: function( value ){
    var hours = Math.floor( value / 60 );
    var mins = ( value - hours*60 );
    return (hours &lt; 10 ? "0"+hours : hours) + ":" + ( mins == 0 ? "00" : mins );
  },
  onstatechange: function( value ){
    console.dir( this );
  }
}</pre>
    </div>
    <div class="layout-slider">
      <input id="Slider5" type="slider" name="area" value="600;720" />
    </div>
    <script type="text/javascript" charset="utf-8">
      jQuery("#Slider5").slider({ from: 480, to: 1020, step: 15, dimension: '', scale: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00'], limits: false, calculate: function( value ){
        var hours = Math.floor( value / 60 );
        var mins = ( value - hours*60 );
        return (hours < 10 ? "0"+hours : hours) + ":" + ( mins == 0 ? "00" : mins );
      }})
    </script>
  </div>
<div style="text-align:center;clear:both">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滑动导航菜单 图片拖动 滑动选项卡切换 文字拖动 图片滑动 拖动排序 文字滑动 弹出层拖动 滑动手风琴 滑动星星打分 滑动滑过 拖动拽动

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到