Forums › Forums › Search & Filter Pro › using date picker on mobile
- This topic has 7 replies, 2 voices, and was last updated 7 years, 9 months ago by
Trevor.
Viewing 7 posts - 1 through 7 (of 7 total)
-
Trevor(Private) October 21, 2017 at 3:05 pm #137646
Only by using javascript. StackExchange has many threads, but, in essence, when the datepicker is opened, the date field gets the focus. In turn, this triggers the keyboards. To stop this, you need to capture the focus ON event, and ‘blur’ the field, sort of like this:
$('datefieldnamehere') .on('focus',function() { $(this).trigger('blur'); } );
It may need to look like this for WordPress jQuery:
jQuery('datefieldnamehere') .on('focus',function() { jQuery(this).trigger('blur'); } );
Where you would put a valid CSS handle for the field where I have put datefieldnamehere.
Anonymous(Private) October 23, 2017 at 10:39 am #137935OK this code does the trick! 🙂 feel free to share or pin this post…
<script type="text/javascript"> jQuery( document ).ready(function() { var ybdDatePick = jQuery( ".hasDatepicker" ); jQuery(function() { ybdDatePick.datepicker({ }).attr('readonly','readonly'); ybdDatePick.on('focus',function() { jQuery(this).trigger('blur'); this.datepicker({ }).attr('readonly','readonly'); console.log( "eeeee!" ); } ); }); }); </script>
and regarding the calendar size on mobile – this is what i did so user can see the calendar all over the screen:
/*calendar*/ @media only screen and (max-width: 768px) { #ui-datepicker-div {width: 100% !important;left: 0 !important;} table.ui-datepicker-calendar {min-height: 200px;} }
-
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)