jQuery(document).ready(function($){
if($.fn.swipe){
$(".carousel .carousel-inner").swipe({
swipeLeft: function(event, direction, distance, duration, fingerCount){
$(this).parent().carousel("next");
},
swipeRight: function(){
$(this).parent().carousel("prev");
},
threshold: 0,
tap: function(event, target){
var href=$(this).find(".carousel-item.active a").attr("href");
if(href) window.location=href;
},
excludedElements: "label, button, input, select, textarea, .noSwipe"
});
}
$('.menu-dropdown ul.menu, .menu-dropdown ul.sub-menu').on('mousewheel', function(e){
e.preventDefault();
this.scrollTop -=(e.originalEvent.wheelDelta / 2);
});
function initTestSelect2(){
var $field=$('#form-field-test_name');
if($field.length&&!$field.hasClass('select2-hidden-accessible')){
$field.select2({
placeholder: "Select Tests",
width: 'resolve',
allowClear: true
});
}}
initTestSelect2();
var checkExist=setInterval(function(){
if($('#form-field-test_name').length){
initTestSelect2();
clearInterval(checkExist);
}}, 300);
var phoneFields=$(
'#wpforms-15013-field_5, ' +
'#wpforms-15034-field_5, ' +
'#wpforms-15039-field_5'
);
if(phoneFields.length){
phoneFields.on('input', function(){
let val=$(this).val();
val=val.replace(/\D/g, '');
if(val.length >=1&&!val.startsWith('03')){
val='03';
}
if(val.length > 11){
val=val.slice(0, 11);
}
$(this).val(val);
});
phoneFields.on('paste', function(e){
e.preventDefault();
let pasted=(e.originalEvent||e).clipboardData.getData('text');
pasted=pasted.replace(/\D/g, '');
if(!pasted.startsWith('03')){
pasted='03';
}
$(this).val(pasted.slice(0, 11));
});
}});