$('.nav').nav(); $('.slider').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, arrow: true }); $('.news_banner').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, arrows: false, dots: true }); // google map // Initialize and add the map function initMap() { // The location of Uluru var uluru = { lat: 22.280341, lng: 114.184379 }; // The map, centered at Uluru var map = new google.maps.Map(document.getElementById('map'), { zoom: 18, center: uluru }); // The marker, positioned at Uluru var marker = new google.maps.Marker({ position: uluru, map: map }); } // scroll top $(document).ready(function() { //Check to see if the window is top if not then display button $(window).scroll(function() { if ($(this).scrollTop() > 50) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); //Click event to scroll to top $('.scrollToTop').click(function() { $('html, body').animate({ scrollTop: 0 }, 500); return false; }); }); // about tab $(document).ready(function() { $('.sidetab a:not(:first)').addClass('inactive'); $('.tab_content .content').hide(); $('.tab_content .content:first').show(); $('.sidetab a').click(function() { var t = $(this).attr('id'); if ($(this).hasClass('inactive')) { //this is the start of our condition $('.sidetab a').addClass('inactive'); $(this).removeClass('inactive'); $('.tab_content .content').hide(); $('#' + t + '-equipment').fadeIn('slow'); } }); }); // tips tab $(document).ready(function() { $('.tips_tab a:not(:first)').addClass('inactive'); $('.tips_content').hide(); $('.tips_content:first').show(); $('.tips_tab a').click(function() { var t = $(this).attr('id'); if ($(this).hasClass('inactive')) { //this is the start of our condition $('.tips_tab a').addClass('inactive'); $(this).removeClass('inactive'); $('.tips_content').hide(); $('#' + t + '-content').fadeIn('slow'); } }); }); // service item $('.plan_box').mouseenter( function(){ $('.plan_box .item').removeClass('active'); $('.plan_box .item').addClass('hide'); $(this).children('.item').removeClass('hide'); $(this).children('.item').addClass('active'); }); $('.plan_box .item').mouseleave( function(){ $('.plan_box .item').removeClass('active hide'); }); // fix table header (function($) { $.fn.fixMe = function() { return this.each(function() { var $this = $(this), $t_fixed; function init() { $this.wrap('
'); $t_fixed = $this.clone(); $t_fixed.find("tbody").remove().end().addClass("fixed").insertBefore($this); resizeFixed(); } function resizeFixed() { $t_fixed.find("th").each(function(index) { $(this).css("width",$this.find("th").eq(index).outerWidth()+"px"); }); } function scrollFixed() { var offset = $(this).scrollTop(), tableOffsetTop = $this.offset().top, tableOffsetBottom = tableOffsetTop + $this.height() - $this.find("thead").height(); if(offset < tableOffsetTop || offset > tableOffsetBottom) $t_fixed.hide(); else if(offset >= tableOffsetTop && offset <= tableOffsetBottom && $t_fixed.is(":hidden")) $t_fixed.show(); } $(window).resize(resizeFixed); $(window).scroll(scrollFixed); init(); }); }; })(jQuery); $(document).ready(function(){ $(".table_plan table").fixMe(); }); // resize // Change width value on page load // $(document).ready(function(){ // responsive_resize(); // }); // Change width value on user resize, after DOM // $(window).resize(function(){ // responsive_resize(); // }); // function responsive_resize(){ // var current_width = $(window).width(); // //do something with the width value here! // if(current_width < 991){ // $('.tableOption button').removeClass('active'); // $('.tableOption button:nth-child(1),.tableOption button:nth-child(2),.tableOption button:nth-child(3),.tableOption button:nth-child(4)').addClass('active'); // } // if(current_width < 767){ // $('.tableOption button').removeClass('active'); // $('.tableOption button:nth-child(1),.tableOption button:nth-child(2)').addClass('active'); // } // if(current_width < 540){ // $('.tableOption button').removeClass('active'); // $('.tableOption button:nth-child(1)').addClass('active'); // } // } $(window).load(function() { var viewportWidth = $(window).innerWidth(); if (viewportWidth < 991) { $('.tableOption button').removeClass('active'); $('.tableOption button:nth-child(1),.tableOption button:nth-child(2),.tableOption button:nth-child(3),.tableOption button:nth-child(4)').addClass('active'); } if (viewportWidth < 767) { $('.tableOption button').removeClass('active'); $('.tableOption button:nth-child(1),.tableOption button:nth-child(2)').addClass('active'); } if (viewportWidth < 540) { $('.tableOption button').removeClass('active'); $('.tableOption button:nth-child(1)').addClass('active'); } }); $('.tableOption button:nth-child(1)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(2) , .table_plan th:nth-child(2)').fadeToggle(); }); $('.tableOption button:nth-child(2)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(3) , .table_plan th:nth-child(3)').fadeToggle(); }); $('.tableOption button:nth-child(3)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(4) , .table_plan th:nth-child(4)').fadeToggle(); }); $('.tableOption button:nth-child(4)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(5) , .table_plan th:nth-child(5)').fadeToggle(); }); $('.tableOption button:nth-child(5)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(6) , .table_plan th:nth-child(6)').fadeToggle(); }); $('.tableOption button:nth-child(6)').click(function() { $(this).toggleClass('active'); $('.table_plan td:nth-child(7) , .table_plan th:nth-child(7)').fadeToggle(); }); $(document).ready(function footerHeight(){ var footerheight = $("footer").outerHeight(); $(".wrapper").css('padding-bottom', footerheight); }); $(window).on('resize', function() { var footerheight = $("footer").outerHeight(); $(".wrapper").css('padding-bottom', footerheight); });