Ad
How Can I Put My Input Field Above My Slider Javascript
I am making a rangeslider with an input field. The input field displays the value of the slider. I want the input field to be above the slider at all time. At this moment its only above the slider when its sliding. If you havent clicked it it will be on the left of the slider and i want it to be above the slider also if it isnt clicked yet.
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#<?php echo $id; ?>').rangeslider({
onSlide: function (position, value) {
var left = $('.rangeslider__handle').css('left');
var val = $('input[type="range"]').val();
$('.floating-number-input').css({
'left': left,
});
// makes sure that the input has the value of the slider
$('.slider-input input[type="number"]').val( val );
}
});
});
</script>
Ad
Answer
After trying some stuff I found the solution. What worked for me was adding the next line of code. At the end of my function.
$('#<?php echo $id; ?>').rangeslider('update', true);
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad