4 895 Скрипты / Slider

jQuery UI слайдер


Слайд бар на jQuery и jQuery UI.

HTML

<div class="slider"></div>
<div id="slider-result">50</div>
<input type="hidden" id="hidden"/>

CSS

JS

Подключаем jQuery и jQuery UI:

<script type="text/jаvascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script> 

И скрипт обработки:

$(".slider").slider({
  animate: true,
  range: "min",
  value: 50,
  min: 10,
  max: 100,
  step: 10,
  //this gets a live reading of the value and prints it on the page
  slide: function(event, ui) {
    $("#slider-result").html(ui.value);
  },
  //this updates the hidden form field so we can submit the data using a form
  change: function(event, ui) {
    $('#hidden').attr('value', ui.value);
  }
});
Скачать 726Загрузок 15,48 Kb
Демо

Комментарии

  • Facebook
  • Вконтакте

Похожие статьи