Ad
Jquery Price Slider Can't Scroll In Mobile Device
I'm making the price slider in my wordpress site, I'm using Jquery price slider from this link. When I check on my desktop the slider's working well but on my phone I can't scroll the slider.
Here is my code:
$(function() {
$("#slider-range").slider({
range: true,
min: 40,
max: 210,
values: [40, 210],
slide: function(event, ui) {
$("#amount").html("$" + ui.values[0] + " - $" + ui.values[1]);
$("#min_price").val(ui.values[0]);
$("#max_price").val(ui.values[1]);
}
});
$("#amount").html("$" + $("#slider-range").slider("values", 0) +
" - $" + $("#slider-range").slider("values", 1));
});
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<label class="field_label" for="slider-range">Price Slider:</label>
<div class="price_slider_wrapper">
<div id="slider-range"></div>
<div class="price_slider_amount">
<input type="text" id="min_price" name="min_price" value="40" data-min="40" placeholder="Min price" style="display: none;">
<input type="text" id="max_price" name="max_price" value="210" data-max="210" placeholder="Max price" style="display: none;">
<div class="clear"></div>
</div>
<p>Price: <span id="amount"></span></p>
</div>
Ad
Answer
One of the possible workaround is using jQuery UI Touch Punch.
You could try to include jQuery UI Touch Punch after jQuery and jQuery UI.
<script src="jquery.ui.touch-punch.min.js"></script>
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