Server IP : 108.170.25.35 / Your IP : 3.144.25.14 Web Server : Apache/2 System : Linux gains.winzonesoftech.com 4.18.0-513.24.1.el8_9.x86_64 #1 SMP Mon Apr 8 11:23:13 EDT 2024 x86_64 User : valamburi ( 1607) PHP Version : 8.1.28 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/valamburi/domains/valamburiinteriors.com/private_html/js/ |
Upload File : |
/* JS Document */ /****************************** [Table of Contents] 1. Vars and Inits 2. Set Header 3. Init Menu 4. Init Date Picker 5. Init Accordions 6. Init Tabs 7. Init Loaders 8. Init Milestones 9. Init SVG ******************************/ $(document).ready(function() { "use strict"; /* 1. Vars and Inits */ var header = $('.header'); var ctrl = new ScrollMagic.Controller(); setHeader(); $(window).on('resize', function() { setHeader(); setTimeout(function() { $(window).trigger('resize.px.parallax'); }, 375); }); $(document).on('scroll', function() { setHeader(); }); initMenu(); initDatePicker(); initAccordions(); initTabs(); initLoaders(); initMilestones(); initSvg(); /* 2. Set Header */ function setHeader() { if($(window).scrollTop() > 91) { header.addClass('scrolled'); } else { header.removeClass('scrolled'); } } /* 3. Init Menu */ function initMenu() { if($('.menu').length) { var menu = $('.menu'); var hamburger = $('.hamburger'); var close = $('.menu_close'); hamburger.on('click', function() { menu.toggleClass('active'); }); close.on('click', function() { menu.toggleClass('active'); }); } } /* 4. Init Date Picker */ function initDatePicker() { if($('.datepicker').length) { var datePickers = $('.datepicker'); datePickers.each(function() { var dp = $(this); // Uncomment to use date as a placeholder // var date = new Date(); // var dateM = date.getMonth() + 1; // var dateD = date.getDate(); // var dateY = date.getFullYear(); // var dateFinal = dateM + '/' + dateD + '/' + dateY; var placeholder = dp.data('placeholder'); dp.val(placeholder); dp.datepicker(); }); } } /* 5. Init Accordions */ function initAccordions() { if($('.accordion').length) { var accs = $('.accordion'); accs.each(function() { var acc = $(this); if(acc.hasClass('active')) { var panel = $(acc.next()); var panelH = panel.prop('scrollHeight') + "px"; if(panel.css('max-height') == "0px") { panel.css('max-height', panel.prop('scrollHeight') + "px"); } else { panel.css('max-height', "0px"); } } acc.on('click', function() { if(acc.hasClass('active')) { acc.removeClass('active'); var panel = $(acc.next()); var panelH = panel.prop('scrollHeight') + "px"; if(panel.css('max-height') == "0px") { panel.css('max-height', panel.prop('scrollHeight') + "px"); } else { panel.css('max-height', "0px"); } } else { acc.addClass('active'); var panel = $(acc.next()); var panelH = panel.prop('scrollHeight') + "px"; if(panel.css('max-height') == "0px") { panel.css('max-height', panel.prop('scrollHeight') + "px"); } else { panel.css('max-height', "0px"); } } }); }); } } /* 6. Init Tabs */ function initTabs() { if($('.tab').length) { $('.tab').on('click', function() { $('.tab').removeClass('active'); $(this).addClass('active'); var clickedIndex = $('.tab').index(this); var panels = $('.tab_panel'); panels.removeClass('active'); $(panels[clickedIndex]).addClass('active'); }); } } /* 7. Init Loaders */ function initLoaders() { if($('.loader').length) { var loaders = $('.loader'); loaders.each(function() { var loader = this; var endValue = $(loader).data('perc'); var loaderScene = new ScrollMagic.Scene({ triggerElement: this, triggerHook: 'onEnter', reverse:false }) .on('start', function() { var bar = new ProgressBar.Circle(loader, { color: '#ffa37b', // This has to be the same size as the maximum width to // prevent clipping strokeWidth: 2.5, trailWidth: 0, trailColor: 'transparent', easing: 'easeInOut', duration: 1400, text: { autoStyleContainer: false }, from:{ color: '#ffa37b', width: 2.5 }, to: { color: '#ffa37b', width: 2.5 }, // Set default step function for all animate calls step: function(state, circle) { circle.path.setAttribute('stroke', state.color); circle.path.setAttribute('stroke-width', state.width); var value = Math.round(circle.value() * 100); if (value === 0) { circle.setText('0%'); } else { circle.setText(value + "%"); } } }); bar.animate(endValue); // Number from 0.0 to 1.0 }) .addTo(ctrl); }); } } /* 8. Init Milestones */ function initMilestones() { if($('.milestone_counter').length) { var milestoneItems = $('.milestone_counter'); milestoneItems.each(function(i) { var ele = $(this); var endValue = ele.data('end-value'); var eleValue = ele.text(); /* Use data-sign-before and data-sign-after to add signs infront or behind the counter number */ var signBefore = ""; var signAfter = ""; if(ele.attr('data-sign-before')) { signBefore = ele.attr('data-sign-before'); } if(ele.attr('data-sign-after')) { signAfter = ele.attr('data-sign-after'); } var milestoneScene = new ScrollMagic.Scene({ triggerElement: this, triggerHook: 'onEnter', reverse:false }) .on('start', function() { var counter = {value:eleValue}; var counterTween = TweenMax.to(counter, 4, { value: endValue, roundProps:"value", ease: Circ.easeOut, onUpdate:function() { document.getElementsByClassName('milestone_counter')[i].innerHTML = signBefore + counter.value + signAfter; } }); }) .addTo(ctrl); }); } } /* 9. Init SVG */ function initSvg() { if($('img.svg').length) { jQuery('img.svg').each(function() { var $img = jQuery(this); var imgID = $img.attr('id'); var imgClass = $img.attr('class'); var imgURL = $img.attr('src'); jQuery.get(imgURL, function(data) { // Get the SVG tag, ignore the rest var $svg = jQuery(data).find('svg'); // Add replaced image's ID to the new SVG if(typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); } // Add replaced image's classes to the new SVG if(typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass+' replaced-svg'); } // Remove any invalid XML tags as per http://validator.w3.org $svg = $svg.removeAttr('xmlns:a'); // Replace image with new SVG $img.replaceWith($svg); }, 'xml'); }); } } });