73 lines
2.0 KiB
JavaScript
73 lines
2.0 KiB
JavaScript
document.addEventListener("DOMContentLoaded", function(event) {
|
|
var valuesForSlider = [2,3,4,5];
|
|
|
|
var format = {
|
|
to: function(value) {
|
|
return valuesForSlider[Math.round(value)];
|
|
},
|
|
from: function (value) {
|
|
return valuesForSlider.indexOf(Number(value));
|
|
}
|
|
};
|
|
var slider = document.getElementById('slider');
|
|
noUiSlider.create(slider, {
|
|
start: [2, 3],
|
|
connect: true,
|
|
tooltips: true,
|
|
step: 1,
|
|
range: {
|
|
'min': 0,
|
|
'max': valuesForSlider.length - 1
|
|
},
|
|
format: format
|
|
});
|
|
});
|
|
|
|
(function($){
|
|
$(function(){
|
|
|
|
$('.sidenav').sidenav();
|
|
|
|
}); // end of document ready
|
|
$(document).ready(function(){
|
|
$('#advanced-tree').hide();
|
|
$('.input-field span.helper-text').hide();
|
|
$('.input-field').bind('mouseenter', function(e) {
|
|
$(this).find('span.helper-text').show('fast')
|
|
});
|
|
var advancedTreeExpanded = false;
|
|
$('#advanced-tree-expand').bind('click', function(e) {
|
|
if (!advancedTreeExpanded){
|
|
advancedTreeExpanded = true;
|
|
$('#advanced-tree').show('fast');
|
|
$('#advanced-tree-expand i').text('remove');
|
|
} else {
|
|
advancedTreeExpanded = false;
|
|
$('#advanced-tree').hide('fast');
|
|
$('#advanced-tree-expand i').text('add');
|
|
}
|
|
$(this).find('span.helper-text').show('fast')
|
|
});
|
|
$('.input-field').bind('mouseleave', function(e) {
|
|
$(this).find('span.helper-text').hide('fast')
|
|
});
|
|
});
|
|
|
|
$("#submit-form").submit( function(eventObj) {
|
|
var spans = $(".noUi-tooltip").find('span');
|
|
var tree_size_min = spans[0].innerText;
|
|
var tree_size_max = spans[1].innerText;
|
|
console.log('amm');
|
|
$("<input />").attr("type", "hidden")
|
|
.attr("name", "tree_size_min")
|
|
.attr("value", tree_size_min)
|
|
.appendTo("#submit-form");
|
|
$("<input />").attr("type", "hidden")
|
|
.attr("name", "tree_size_max")
|
|
.attr("value", tree_size_max)
|
|
.appendTo("#submit-form");
|
|
return true;
|
|
});
|
|
})(jQuery); // end of jQuery name space
|
|
|