/*================ Template Name: AppCo App Landing Page Template Description: AppCo is app and product landing page template. Version: 1.0 Author: https://themeforest.net/user/themetags =======================*/ // TABLE OF CONTENTS // 0. Mutual Funds Calculator // 1. fixed navbar // 2. page scrolling feature - requires jQuery Easing plugin // 3. closes the responsive menu on menu item click // 4. magnify popup video // 5. client testimonial slider // 6. Screenshots slider // 7. custom counter js with scrolling // 8. client-testimonial one item carousel // 9. our clients logo carousel // 10. our clients logo carousel // 11. wow js function delay(callback, ms) { var timer = 0; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } jQuery(function ($) { 'use strict'; // 0. Mutual Funds Calculator var type_of_investment = "monthly_sip" $('#PrincipalAmount').keyup(delay(function(val){ find_mutual_funds(); }, 500)); $('#RateOfInterest').change(delay(function(val){ find_mutual_funds(); }, 500)); $('#DurationOfInvestment').change(delay(function(val){ find_mutual_funds(); }, 100)); $('input[type=radio][name=options]').change(function(val){ type_of_investment = this.value; if(type_of_investment == "monthly_sip"){ $('#frequency_indicator').html("Per Month"); }else{ $('#frequency_indicator').html("One-time"); } find_mutual_funds() }); function find_mutual_funds(){ $('#loader_mutual_fund_results').show(); $('#mutual_fund_results').hide(); var principal_amount = parseFloat($('#PrincipalAmount').val()); var rate_of_interest = parseInt($('#RateOfInterest').val()); var duration_of_investment = parseInt($('#DurationOfInvestment').val()); if(type_of_investment == "monthly_sip"){ $('#total_investment').html(indianize_currency((principal_amount*12*duration_of_investment).toString())) }else{ $('#total_investment').html(indianize_currency(principal_amount.toString())) } $('#amount_doubled_in').html(calculate_doubling_period(principal_amount, rate_of_interest, type_of_investment)) $.ajax({url: "find_mutual_funds?p="+principal_amount.toString()+ "&r="+ rate_of_interest.toString()+ "&t="+ duration_of_investment.toString()+ "&type_of_investment="+ type_of_investment+ "&n=1", success: function(result){ $('#loader_mutual_fund_results').hide(); $('#mutual_fund_results').show(); update_results_in_html(result); if(localStorage.getItem('show_suggestions_enabled', false) == 'true'){ remove_blur(); } }}); } function calculate_doubling_period(p, r, investment_type){ if(investment_type == 'monthly_sip'){ var is_doubled = false; var principal_amount = p; var months = 0 while(!is_doubled){ p = p + p * (r/100)/12; if(p >= 2*principal_amount){ is_doubled = true; } months += 1 } return Math.round((months/12)*10)/10; }else{ return Math.round((72/r)*10)/10; } } $('#show_all_button').click(function(){ $('#registrationModal').modal(); $('#message_hidden_modal').val('') }); var brochure_file_names = { 'All rounder Basket Enquiry': 'All rounder Basket - Brochure.pdf', 'T20 Basket Enquiry': 'T20 Basket - Brochure.pdf', 'Beat the FDs Basket Enquiry': 'Beat The FDs Basket - Brochure.pdf' } $('[aria-label="connect_with_us_section"]').click(function(){ if($(this).attr('aria-describedby') != undefined){ $('#show_all_form_button').html("Connect with us") $('#message_hidden_modal').val($(this).attr('aria-describedby')) } if(localStorage.getItem('info_for_brochure_shared', false) == 'true' && brochure_file_names.hasOwnProperty($(this).attr('aria-describedby'))){ window.open('/static/landing_page/brochures/' + brochure_file_names[$(this).attr('aria-describedby')], '_blank'); }else{ $('#registrationModal').modal(); } }) $('#btnContactUs').click(function(){ var name = $('#name').val(); var email = $('#email').val(); var phone = $('#phone').val(); var city = $('#city').val(); var message = $('#message').val(); if(name == "" || email == "" || phone == "" || city == "" || message == ""){ $('#contact_form_error_msg').show(); }else if(phone.length != 10){ $('#contact_form_error_msg').show(); $('#contact_form_error_msg').html("Please enter a valid mobile number!"); }else{ $('#contact_form_error_msg').hide(); $.ajax({url: "create_user_enquiry?full_name="+name.toString()+ "&mobile_number="+ phone.toString()+ "&email="+ email.toString()+ "&city="+ city.toString()+ "&message="+ message.toString(), success: function(result){ alert('Thank you, we will get in touch with you soon'); location.reload(); }}); } }); $('#show_all_form_button').click(function(){ var name = $('#your_name').val(); var mobile_number = $('#mobile_number').val(); var message_param = '' if($('#message_hidden_modal').val()!=''){ message_param = "&message="+$('#message_hidden_modal').val(); } if(name.length < 2 || mobile_number.length != 10){ $('#error_msg').show(); }else{ $('#error_msg').hide(); $(this).html("Submitting..") $.ajax({url: "create_user_enquiry?full_name="+name.toString()+ "&mobile_number="+ mobile_number.toString() + message_param, success: function(result){ $('#registrationModal').modal('hide'); alert('Thank you, we will get in touch with you soon'); if(message_param == ''){ localStorage.setItem('show_suggestions_enabled', true); remove_blur(); }else{ localStorage.setItem('info_for_brochure_shared', true); if(brochure_file_names.hasOwnProperty(message_param)){ window.open('/static/landing_page/brochures/' + brochure_file_names[message_param], '_blank'); } } }}); } }); function remove_blur(){ $('#blur-area').css('filter', 'blur(0px)'); $('#show_all_button').hide(); } function update_results_in_html(result){ for(var i =1; i<=5; i++){ $('#result_'+i.toString()).hide() } var counter = 1; $(result['results']).each(function(){ $('#result_'+ counter.toString()).show(); $('#result_'+ counter.toString() +' .fund_name').html($(this)[0].fund_name.substring(0,18) + "...") $('#result_'+ counter.toString() +' .fund_name').attr('title', $(this)[0].fund_name) $('#result_'+ counter.toString() +' .crisil_rank').html(parseFloat($(this)[0].crisil_rank)) $('#result_'+ counter.toString() +' .aum').html(indianize_currency($(this)[0].aum)) $('#result_'+ counter.toString() +' .final_maturity').html(indianize_currency($(this)[0].absolute_value.toString())) $('#result_'+ counter.toString() +' .actual_returns').html(indianize_currency($(this)[0].rate_of_return.toString())+"%") counter+=1; }) } function indianize_currency(num){ return num.replace(/(\d)(?=(\d\d)+\d$)/g, "$1,"); } //Initial call to find_mutual_funds // find_mutual_funds(); // 1. fixed navbar $(window).on( 'scroll', function () { // checks if window is scrolled more than 500px, adds/removes solid class if ($(this).scrollTop() > 60) { $('.navbar').addClass('affix'); } else { $('.navbar').removeClass('affix'); } }); // 2. page scrolling feature - requires jQuery Easing plugin $(function() { $(document).on('click', 'a.page-scroll', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top-60 }, 900, 'easeInOutExpo'); event.preventDefault(); }); }); // 3. closes the responsive menu on menu item click $(".navbar-nav li a").on("click", function(event) { if (!$(this).parent().hasClass('dropdown')) $(".navbar-collapse").collapse('hide'); }); // 4. magnify popup video $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({ disableOn: 700, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: false }); // 5. client testimonial slider $('.client-testimonial').owlCarousel({ loop:false, margin:30, items:1, nav: true, dots:false, responsiveClass:true, autoplay:false, autoplayHoverPause:true, lazyLoad:true, }) // 6. Screenshots slider $('.screen-carousel').owlCarousel({ loop: true, margin: 0, center: true, dots: true, nav: false, autoplay: true, responsive: { 0: { items: 1 }, 768: { items: 3 }, 991: { items: 4 }, 1200: { items: 4 }, 1920: { items: 4 } } }); // 7. custom counter js with scrolling var isFirstTime = true; var interval = null; var countSelector = $('.single-counter > span, .single-card > h3'); if(countSelector.length) { var startingTop = countSelector.offset().top - window.innerHeight; if(startingTop > 0) { $(window).on( 'scroll', function() { if (isFirstTime && $(window).scrollTop() > startingTop) { startCounting(); isFirstTime = false; } }); } else{ startCounting(); } } /** * Get the increment value * @param value * @returns {number} */ function incrementValue(value) { var incVal = 0; if(Math.ceil(value / 2) <= 5){ // upto 10 incVal = 1; } else if(Math.ceil(value / 10) <= 10) { // up to 100 incVal = 10; } else if(Math.ceil(value / 100) <= 10) { // up to 1000 incVal = 25; } else if(Math.ceil(value / 100) <= 100) { // up to 10000 incVal = 50; } else if(Math.ceil(value / 1000) <= 100) { // up to 100000 incVal = 150; } else { incVal = 500; } return incVal; } /** * To start count * @param counters all selectors * @param start int * @param value int * @param id int */ function count(counters, start, value, id) { var localStart = start; var inc = incrementValue(value); interval = setInterval(function() { if (localStart < value) { localStart = localStart+inc; counters[id].innerHTML = localStart; } }, 40); } /** * Start the count */ function startCounting() { var counters = $(".single-counter > span, .single-card > h3"); var countersQuantity = counters.length; var counter = []; // get al counts from HTML count for (var i = 0; i < countersQuantity; i++) { counter[i] = parseInt(counters[i].innerHTML); } // calling all count function for (var j = 0; j < countersQuantity; j++) { count(counters, 0, counter[j], j); } } // 8. client-testimonial one item carousel $('.client-testimonial-1').owlCarousel({ loop:true, margin:30, nav: false, responsiveClass:true, autoplay:true, autoplayHoverPause:true, lazyLoad:true, items:1, }) // 9. our clients logo carousel $('.clients-carousel').owlCarousel({ autoplay: true, loop: true, margin:15, dots:true, slideTransition:'linear', autoplayTimeout:4500, autoplayHoverPause:true, autoplaySpeed:4500, responsive:{ 0:{ items:2 }, 500: { items:3 }, 600:{ items:4 }, 800:{ items:5 }, 1200:{ items:6 } } }) // 11. wow js function wowAnimation(){ new WOW({ offset: 100, mobile: true }).init() } wowAnimation() //countdown one $('#clock').countdown('2022/01/30', function(event) { $(this).html(event.strftime('' + '
' + '
' + '

%-D

' + '
Day%!d
' + '
' + '
' + '

%H

' + '
Hours
' + '
' + '
' + '

%M

' + '
Minutes
' + '
' + '
' + '

%S

' + '
Seconds
' + '
' + '
')); }); // Subscription if($("#getQuoteFrm").length) { $("#getQuoteFrm").validator().on("submit", function (event) { if (event.isDefaultPrevented()) { // handle the invalid form... submitMSG(false); } else { // everything looks good! event.preventDefault(); submitGetQuoteForm(); } }); } function submitGetQuoteForm(){ // Initiate Variables With Form Content var name = $('#getQuoteFrm input[name="name"]').val(); var email = $('#getQuoteFrm input[name="email"]').val(); var subject = $('#getQuoteFrm input[name="subject"]').val(); var message = $('#getQuoteFrm textarea[name="message"]').val(); if (!$('#getQuoteFrm #exampleCheck1').is(":checked")) { submitMSG(false, '.sign-up-form-wrap'); return; } $.ajax({ type: "POST", url: "libs/quote-form-process.php", data: "name=" + name + "&email=" + email + "&subject=" + subject + "&message=" + message, success : function(text){ if (text == "success"){ quoteFormSuccess(); } else { submitMSG(false, '.sign-up-form-wrap'); } } }); } function quoteFormSuccess(){ $("#getQuoteFrm")[0].reset(); submitMSG(true, '.sign-up-form-wrap'); } // contact form if($("#contactForm").length) { $("#contactForm").validator().on("submit", function (event) { if (event.isDefaultPrevented()) { // handle the invalid form... submitMSG(false, '.contact-us'); } else { // everything looks good! event.preventDefault(); submitContactForm(); } }); } function submitContactForm(){ // Initiate Variables With Form Content var name = $("#contactForm #name").val(); var email = $("#contactForm #email").val(); var phone = $("#contactForm #phone").val(); var company = $("#contactForm #company").val(); var message = $("#contactForm #message").val(); $.ajax({ type: "POST", url: "libs/contact-form-process.php", data: "name=" + name + "&email=" + email + "&phone=" + phone + "&company=" + company + "&message=" + message, success : function(text){ if (text == "success"){ formSuccess(); } else { submitMSG(false, '.contact-us'); } } }); } function formSuccess(){ $("#contactForm")[0].reset(); submitMSG(true, '.contact-us'); } function submitMSG(valid, parentSelector){ if(valid){ $(parentSelector + " .message-box").removeClass('d-none').addClass('d-block '); $(parentSelector + " .message-box div").removeClass('alert-danger').addClass('alert-success').text('Form submitted successfully'); } else { $(parentSelector + " .message-box").removeClass('d-none').addClass('d-block '); $(parentSelector + " .message-box div").removeClass('alert-success').addClass('alert-danger').text('Found error in the form. Please check again.'); } } }); // JQuery end