${trip.noDays} days tailor made from // £ ${trip.fromPrice} //
//jQuery(document).ready(function ($) { /** * Contact Form Related Code */ $('.ts-c-form .nav .nav-item .nav-link').click(function () { var form = $(this).closest('.ts-c-form'); var totalSteps = form.find('.steps .tab-content .tab').length; }); //Button Next: Click to show the next tab $('.ts-c-form .btn-next').click(function () { var form = $(this).closest('.ts-c-form'); form.closest('.ts-c-form').find('.nav .nav-item .nav-link i').css('opacity', '1'); form.find('.steps .tab-content .tab').removeClass('active'); form.find('.steps .tab-content .tab').eq(1).addClass('active'); }); //Button Previous: Click to show the previous tab $('.ts-c-form .btn-prev').click(function () { var form = $(this).closest('.ts-c-form'); form.closest('.ts-c-form').find('.nav .nav-item .nav-link i').css('opacity', '0'); form.find('.steps .tab-content .tab').removeClass('active'); form.find('.steps .tab-content .tab').eq(0).addClass('active'); }); //Form Submit $('.ts-c-form').submit(function (e) { e.preventDefault(); var form = $(this); $.ajax({ data: form.serialize(), type: 'post', url: tsAjax.ajaxurl, success: function (data) { console.log(data); $('#form-message').text('Form has been submitted successfully!'); $('#form-message').addClass('text-secondary'); }, error: function (data) { $('#form-message').text('There is an error while submitting the form!'); $('#form-message').addClass('text-white'); } }); }); /** * Currency Switcher */ //Default Currency var userCurrency = 'gbp'; function get_currency_symbol(currency) { switch (currency) { case "GBP": case "gbp": return "£"; case "USD": case "usd": return "$"; case "EUR": case "eur": return "€"; default: return "$"; } } function get_exchange_rate(to, rates) { rate = 0; if (to == "gbp") { if (rates.gbp == "") { if (rates.usd != "") { rate = rates.usd * currency_rates.usd_to_gbp; } else if (rates.eur != "") { rate = rates.eur * currency_rates.eur_to_gbp; } } else { rate = rates.gbp; } } else if (to == "usd") { if (rates.usd == "") { console.log('? Yes USD IS EMPTY!'); if (rates.gbp != "") { rate = rates.gbp * currency_rates.gbp_to_usd; console.log('? GBP price is ', currency_rates.gbp_to_usd, '?? Converted Price is ', rate); $('.lang-subject-to-change').each(function() { $(this).text( $(this).attr('data-version-us') ); }); } else if (rates.eur != "") { rate = rates.eur * currency_rates.eur_to_usd; console.log('? Eur price is ', currency_rates.eur_to_usd, '?? Converted Price is ', rate); } } else { console.log('? No USD IS NOT EMPTY! ?? Converted Price is ', rate); rate = rates.usd; } } else if (to == "eur") { if (rates.eur == "") { if (rates.usd != "") { rate = rates.usd * currency_rates.usd_to_eur; } else if (rates.gbp != "") { rate = rates.gbp * currency_rates.gbp_to_eur; } } else { rate = rates.gbp; } } return Math.floor(rate); } function set_currenct_currency_widget_value(currency) { var currency_symbol = get_currency_symbol(currency); //Change the Price for each card based on the userCurrency $('.price').each(function () { var price = ""; var usdPrice = $(this).data('usd'); var gbpPrice = $(this).data('gbp'); var euroPrice = $(this).data('euro'); price = get_exchange_rate(currency, { usd: usdPrice, gbp: gbpPrice, eur: euroPrice }); if (price !== 0 && price % 10 != 0) { while (price % 10 != 0) { price++; } } price = currency_symbol + " " + price; $(this).html(price); }); //Change Phone Number $('.phone-number').each(function () { var phone = ""; switch (currency.toLowerCase()) { case 'gbp': $(this).html(phone_numbers.gbp); phone = phone_numbers.gbp; break; case 'usd': $(this).html(phone_numbers.usd); phone = phone_numbers.usd; break; default: $(this).html(phone_numbers.eur); phone = phone_numbers.eur; } if ($(this).is('a')) { $(this).attr('href', 'tel:' + phone); } }); //Change the text // $('a, button').each(function () { // var text = $(this).text(); // text = text.toLowerCase(); // if(text=="inquire" || text=="enquire"){ // switch (currency.toLowerCase()) { // case 'gbp': // text = "enquire"; // break; // default: // text = "inquire"; // } // } // $(this).text(text); // }); //Change the active currency from the currecny switcher widget $('.currency-switcher').each(function () { $(this).find('.currencies .currency').removeClass('active'); $(this).find('.currencies .currency').each(() => { let currentCurrency = $(this).data('currency'); console.log("?? CURRENT CURRENCY:", currency); if (currentCurrency == currency) { $(this).addClass('active'); } }) let active_currency = $(this).find('.current-currency').data('currency'); if (active_currency != currency) { $(this).find('.current-currency').data('currency', currency); $(this).find('.current-currency .currency').text(currency.toUpperCase() + " ") } }); } //If userCurrency is set, then change it... if (localStorage.getItem('ts_curreny')) { userCurrency = localStorage.getItem('ts_currency'); set_currenct_currency_widget_value(userCurrency); } else { localStorage.setItem('ts_currency', 'gbp'); $.get("https://api.ipdata.co/?api-key=f8f06fec59f41a1c97874cbadc8bc64b2241be4efcd6ec0d3bfc0ecd", function (response) { let country_code = response.country_code; if (country_code == "US") { userCurrency = "usd"; $('.lang-subject-to-change').each(function() { $(this).text( $(this).attr('data-version-us') ); }); } else if (country_code == "IE") { userCurrency = "eur"; $('.lang-subject-to-change').each(function() { $(this).text( $(this).attr('data-version-uk') ); }); } else { userCurrency = "gbp"; $('.lang-subject-to-change').each(function() { $(this).text( $(this).attr('data-version-uk') ); }); } set_currenct_currency_widget_value(userCurrency); }); } //When user changes currency via currency widget $('.currency-switcher .currencies .currency').click(function () { if (!$(this).hasClass('active')) { $('.currency-switcher').find('input').val(currency); var currency = $(this).data('currency'); //$(this).closest('.currencies').hide(); set_currenct_currency_widget_value(currency); } }); /** * Post Slider */ $(".ts-post-slider").owlCarousel({ margin: 15, nav: true, dots: true, rewind: true, responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 3 } }, navText: [ '', '' ] }); /** * Destination Slider */ $(".ts-gallery-slider").owlCarousel({ margin: 10, nav: true, dots: true, loop: true, rewind: false, autoplay: true, // Enables the autoplay feature autoplayTimeout: 5000, // Time each slide is displayed in milliseconds (5000ms = 5 seconds) touchDrag: true, // Ensure touch drag is enabled for touch devices mouseDrag: true, responsive: { 0: { items: 1.5 }, 600: { items: 2 }, 1000: { items: 1 } }, navText: [ '', '' ] }); /** * Image Slider */ $(".ts-owl-slider").owlCarousel({ margin: 10, rewind: true, responsive: { 0: { items: 2 }, 600: { items: 2 }, 1000: { items: 2 } }, navText: [ '', '' ] }); /** * TS Popup Filter */ $(".btn-ts-filter").click(function () { $(".ts_search_filter").show(); }); $(".ts_search_filter .btn-ts-times").click(function () { $(".ts_search_filter").hide(); }); /** * TS Trip Search Filter */ $(".btn-ts-trip-filter").click(function () { $(".ts_trip_search_filter").show(); }); $(".ts_trip_search_filter .btn-ts-times").click(function () { $(".ts_trip_search_filter").hide(); }); /** * Fixed Header */ $(window).scroll(function () { var sticky = $('.sticky'), scroll = $(window).scrollTop(); if (scroll >= 100) sticky.addClass('active'); else sticky.removeClass('active'); }); /** * TS Tabs Widget */ function scrollToActiveTab() { var activeTab = $('.tabs-list li.active'); if (activeTab.length) { var scrollContainer = activeTab.closest('.tabs-list'); var scrollLeft = scrollContainer.scrollLeft(); var tabLeft = activeTab.position().left; var tabRight = tabLeft + activeTab.outerWidth(); var containerLeft = scrollLeft; var containerRight = containerLeft + scrollContainer.width(); if (tabLeft < containerLeft || tabRight > containerRight) { // Adjust the scroll position slightly to show the full tab title scrollContainer.animate({ scrollLeft: tabLeft + scrollLeft - scrollContainer.outerWidth() / 2 + activeTab.outerWidth() / 2 + 10 // Adjust the "10" as needed }, 'fast'); } } } $(".ts-tab-widget .tabs .tabs-list li").click(function () { var tabContainer = $(this).closest('.ts-tab-widget'); tabContainer.find('.tabs .tabs-list li').removeClass('active'); $(this).addClass('active'); var tabID = $(this).data('tab'); tabContainer.find('.tabs-content .tab-content').removeClass('active'); tabContainer.find(`.tabs-content .tab-content[data-tab='${tabID}']`).addClass('active'); scrollToActiveTab(); // Scroll to the active tab }); $(".ts-tab-widget .tab-nav-controls .tab-prev").click(function () { var tabContainer = $(this).closest('.ts-tab-widget'); var activeTab = tabContainer.find('.tabs .tabs-list li.active'); var prevTab = activeTab.prev('li'); if (prevTab.length) { activeTab.removeClass('active'); prevTab.addClass('active'); var tabID = prevTab.data('tab'); tabContainer.find('.tabs-content .tab-content').removeClass('active'); tabContainer.find(`.tabs-content .tab-content[data-tab='${tabID}']`).addClass('active'); scrollToActiveTab(); // Scroll to the active tab } }); $(".ts-tab-widget .tab-nav-controls .tab-next").click(function () { var tabContainer = $(this).closest('.ts-tab-widget'); var activeTab = tabContainer.find('.tabs .tabs-list li.active'); var nextTab = activeTab.next('li'); if (nextTab.length) { activeTab.removeClass('active'); nextTab.addClass('active'); var tabID = nextTab.data('tab'); tabContainer.find('.tabs-content .tab-content').removeClass('active'); tabContainer.find(`.tabs-content .tab-content[data-tab='${tabID}']`).addClass('active'); scrollToActiveTab(); // Scroll to the active tab } }); /** * TS Popup Search Filter */ $(".ts-filter-list-items .item").click(function () { var icon = $(this).find('.icon').html(); var unCheckedIcon = ''; var checkedIcon = ''; var isChecked = $(this).data('checked'); var parentContainer = $(this).closest('.ts-filter-list-items'); if (isChecked === '0' || isChecked == 0) { parentContainer.find('.item').each(function(){ $(this).data('checked', '0'); $(this).removeClass('active'); $(this).find('.icon').html(unCheckedIcon); }); $(this).data('checked', '1'); $(this).addClass('active'); $(this).find('.icon').html(checkedIcon); } }); var allTrips = ""; //Filter Reset $('.btn-reset-filter').click(function () { var type = $(this).data('type'); var filterContainer = $(this).closest('aside'); filterContainer.find('.ts-filter-list-items .item').each(function () { var icon = $(this).find('.icon').html(); var unCheckedIcon = ''; var checkedIcon = ''; var isChecked = $(this).data('checked'); $(this).data('checked', '0'); $(this).removeClass('active'); $(this).find('.icon').html(unCheckedIcon); }); if(type != undefined && type == "trips"){ $('#trips .ts-posts-container .post').each(function(){ $(this).show(); }); } else{ if (allTrips == "") { //Do nothing } else { $('#search-result-container').html(allTrips); } } }); //Button to Apply Filter $('.btn-apply-filter').click(function () { var result = $('#search-result-container').html(); if (allTrips == "") { allTrips = result; } var filterContainer = $(this).closest('aside'); filterContainer.find('.ts-filter-list-items .item').each(function () { var isChecked = $(this).data('checked'); if (isChecked == "1") { var filterName = $(this).data('name'); switch (filterName) { case "trip_length_max": //Ascending Order result = $('#search-result-container .col-md-12').sort(function (a, b) { var contentA = parseInt($(a).data('days')); var contentB = parseInt($(b).data('days')); return (contentA > contentB) ? -1 : (contentA < contentB) ? 1 : 0; }); break; case "trip_length_min": //Descending Order result = $('#search-result-container .col-md-12').sort(function (a, b) { var contentA = parseInt($(a).data('days')); var contentB = parseInt($(b).data('days')); return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0; }); break; case "alphabetical": default: result = allTrips; } $('#search-result-container').html(result); return false; } }); }); /** * TS Veritical Tab Widget */ $(".ts-vertical-tabs .nav-items .nav-item .nav-link").click(function () { var mainContainer = $(this).closest(".ts-vertical-tabs"); mainContainer.find(".nav-items .nav-item .nav-link").removeClass("active"); $(this).addClass("active"); var tabID = $(this).data("tab"); mainContainer.find(".tab-content-container .tab-content").removeClass("active"); mainContainer.find(".tab-content-container .tab-content[data-container='" + tabID + "']").addClass("active"); }); /** * TS Image Slider with Title and Sub Title */ $(".ts-img-slider .nav-controls .btn-prev").click(function () { if (!$(this).hasClass("btn-disabled")) { var sliderContainer = $(this).closest(".ts-img-slider"); var slidesCount = sliderContainer.find(".slide").length; var activeSlide = sliderContainer.find(".slide.active").index(); console.log("ACTIVE TAB:", activeSlide, slidesCount); if (activeSlide <= 0) { $(this).addClass("btn-disabled"); } else { if (activeSlide === slidesCount - 1) { console.log("WELL DONE!"); sliderContainer.find(".nav-controls .btn-next").removeClass("btn-disabled"); } else if (activeSlide - 1 == 0) { $(this).addClass("btn-disabled"); } sliderContainer.find(".slide.active").removeClass("active"); sliderContainer.find(".slide").eq(activeSlide - 1).addClass('active'); } } }); $(".ts-img-slider .nav-controls .btn-next").click(function () { if (!$(this).hasClass('btn-disabled')) { var sliderContainer = $(this).closest(".ts-img-slider"); var slidesCount = sliderContainer.find(".slide").length; var activeSlide = sliderContainer.find(".slide.active").index(); if (activeSlide >= slidesCount - 1) { $(this).addClass('btn-disabled'); } else { if (activeSlide == slidesCount - 2) { $(this).addClass('btn-disabled'); } sliderContainer.find(".btn-prev").removeClass("btn-disabled"); sliderContainer.find(".slide.active").removeClass("active"); sliderContainer.find(".slide").eq(activeSlide + 1).addClass('active'); } } }); /** * LGBT Region Information API Equaldex */ // const EQUALDEX_API_KEY="81c576798cfb61934405cb4f530a689c752ef668"; // var equal_dex_div = $("#lgbt-info"); // if(equal_dex_div.length && equal_dex_div.length>0){ // let country_code = equal_dex_div.data("country"); // let url = "https://www.equaldex.com/api/region?apiKey="+EQUALDEX_API_KEY+"®ionid="+country_code+"&formatted=true"; // $.get(url, function(response){ // console.log(response); // let html = `
Illegal
//Illegal
//Illegal
//Illegal
//Illegal
//${trip.type}
//${trip.content}
//No trips found!
//Error while loading the trips!
//Error while loading the trips!
//