// JavaScript Document jQuery(document).ready(function($) { document.body.className += ' fade-out'; var url = document.location.href; /* initialise clipboard to link icon */ new Clipboard('.link', { text: function() { return url; } }); $(window).resize(function() { // on load //$(".information-container").css("height", $(window).height()); $(".project-container ul").css("width", $(".project-container ul li").length * $(window).width()); $(".project-container").css("height", $(window).height()); $(".project-container ul").css("height", $(window).height()); $(".project-container ul li").css("width", $(window).width()); $(".project-container ul li").css("height", $(window).height()); $(".footprint-container").css("height", $(window).height()); var slider_ratio = 685/1920; $(".banner").css("height", $(".banner").width() * slider_ratio); $(".banner ul").css("width", $(".banner").width() * $(".banner li").length); $(".banner ul li").css("width", $(".banner").width()); $(".banner ul li").css("height", $(".banner").width() * slider_ratio); $(".location-container").css("margin-top", $(".banner").height()) var single_project_ratio = 577/865; $(".single-product-gallery-container").css("height", $(".single-product-gallery-container").width() * single_project_ratio); $(".single-product-gallery-container ul").css("width", $(".single-product-gallery-container").width() * $(".single-product-gallery-container li").length); $(".single-product-gallery-container li").css("height", $(".single-product-gallery-container").width() * single_project_ratio); $(".single-product-gallery-container li").css("width", $(".single-product-gallery-container").width()); $(".vc_column-inner.vc_custom_1523404870405 .vc_gitem-zone.vc_gitem-zone-a.vc-gitem-zone-height-mode-auto.vc-gitem-zone-height-mode-auto-3-4.vc_gitem-is-link").css("height", $(".vc_column-inner.vc_custom_1523404897661 .vc_grid-container.vc_clearfix.wpb_content_element.vc_basic_grid").height()); }).resize(); $(".single-product-gallery-nav .inner").css("width", ($(".single-product-gallery-nav .inner a").length * $(".single-product-gallery-nav .inner a").width()) + (($(".single-product-gallery-nav .inner a").length - 1) * 15)); // subscribe $(".subscribeEmail").click(function(e) { e.preventDefault(); $.ajax({ type: "POST", url: content.template_url + "/webservice.php", data: { action: "add_to_mailing_list", subscribeEmail: $(".txtSubscribeEmail").val() }, success: function(d) { if(d == "email_added") { var tl = new TimelineMax(); tl.to($(".mailing-list .subscribeEmail"), 0.5, { css: { display: "none", opacity: 0 } }); tl.to($(".mailing-list .txtSubscribeEmail"), 0.5, { css: { display: "none", opacity: 0 } }, "-=0.5"); tl.to($(".mailing-list .subscription-added"), 0.5, { css: { display: "block", opacity: 1 } }); tl.to($(".mailing-list .subscription-added"), 0.5, { css: { display: "none", opacity: 0 } }, "+=3"); tl.to($(".mailing-list .subscribeEmail"), 1, { css: { display: "inline-block", opacity: 1 } }); tl.to($(".mailing-list .txtSubscribeEmail"), 1, { css: { display: "inline-block", opacity: 1 } }, "-=1"); } else if(d == "email_exists") { var string = "Email already exists"; $(".mailing-list .error-bubble").empty(); $(".mailing-list .error-bubble").append(string); var tl = new TimelineMax(); tl.to($(".mailing-list .error-container"), 0.5, { css: { display: "block", opacity: 1 } }); } else if(d == "email_invalid") { var string = "Email entry is invalid"; $(".mailing-list .error-bubble").empty(); $(".mailing-list .error-bubble").append(string); var tl = new TimelineMax(); tl.to($(".mailing-list .error-container"), 0.5, { css: { display: "block", opacity: 1 } }); } else if(d == "email_failed_to_add") { var string = "Can't connect to server"; $(".mailing-list .error-bubble").empty(); $(".mailing-list .error-bubble").append(string); var tl = new TimelineMax(); tl.to($(".mailing-list .error-container"), 0.5, { css: { display: "block", opacity: 1 } }); } } }); }); var home_slider_gallery_index = 0; $(".home-slider-gallery-left").click(function(e) { e.preventDefault(); if(home_slider_gallery_index > 0) { home_slider_gallery_index--; TweenMax.to($(".banner ul"), 0.5, { x: -$(".banner").width() * home_slider_gallery_index } ); } }); $(".home-slider-gallery-right").click(function(e) { e.preventDefault(); if(home_slider_gallery_index < $(".banner ul li").length - 1) { home_slider_gallery_index++; TweenMax.to($(".banner ul"), 0.5, { x: -$(".banner").width() * home_slider_gallery_index } ); } }); var single_product_gallery_index = 0; $(".single-product-gallery-left").click(function(e) { e.preventDefault(); if(single_product_gallery_index > 0) { single_product_gallery_index--; TweenMax.to($(".single-product-gallery-container ul"), 0.5, { x: -$(".single-product-gallery-container").width() * single_product_gallery_index } ); } }); $(".single-product-gallery-right").click(function(e) { e.preventDefault(); if(single_product_gallery_index < $(".single-product-gallery-container ul li").length - 1) { single_product_gallery_index++; TweenMax.to($(".single-product-gallery-container ul"), 0.5, { x: -$(".single-product-gallery-container").width() * single_product_gallery_index } ); } }); var project_slider_gallery_index = 0; $(".project-slider-gallery-left").click(function(e) { e.preventDefault(); if(project_slider_gallery_index > 0) { project_slider_gallery_index--; var tl = new TimelineMax(); tl.to($(".project-slider-text"), 1, { autoAlpha: 0 }); tl.to($(".project-slider-container ul"), 0.5, { x: -$(".project-slider-container").width() * project_slider_gallery_index } ); tl.to($(".project-slider-text"), 1, { autoAlpha: 1 }); $(".single-projects-nav a").removeClass("selected"); $(".single-projects-nav a#" + project_slider_gallery_index).addClass("selected"); } }); $(".project-slider-gallery-right").click(function(e) { e.preventDefault(); if(project_slider_gallery_index < $(".project-slider-container ul li").length - 1) { project_slider_gallery_index++; var tl = new TimelineMax(); tl.to($(".project-slider-text"), 1, { autoAlpha: 0 }); tl.to($(".project-slider-container ul"), 0.5, { x: -$(".project-slider-container").width() * project_slider_gallery_index } ); tl.to($(".project-slider-text"), 1, { autoAlpha: 1 }); $(".single-projects-nav a").removeClass("selected"); $(".single-projects-nav a#" + project_slider_gallery_index).addClass("selected"); } }); var nav_index = 0; $("a.single-product-gallery-nav-left").click(function(e) { e.preventDefault(); if(nav_index < 0) { nav_index += $(".single-product-gallery-nav .inner a").width(); if(nav_index > 0) { nav_index = 0; } TweenMax.to($(".single-product-gallery-nav .inner"), 0.5, { x: nav_index }); } }); $("a.single-product-gallery-nav-right").click(function(e) { e.preventDefault(); var scroll_distance = $(".single-product-gallery-nav .inner").width() - $(".single-product-gallery-nav").width(); if(nav_index > -scroll_distance) { nav_index -= $(".single-product-gallery-nav .inner a").width(); if(nav_index < -scroll_distance) { nav_index = -scroll_distance; } TweenMax.to($(".single-product-gallery-nav .inner"), 0.5, { x: nav_index }); } }); $(".single-product-gallery-nav .inner a").click(function(e) { e.preventDefault(); TweenMax.to($(".single-product-gallery-container ul"), 0.5, { x: -$(".single-product-gallery-container").width() * $(this).attr("id") } ); }); // navigation $(".nav-home").click(function() { TweenMax.to($(window), 1.5, { scrollTo: { y: 0 }, ease: Expo.easeOut } ); }); $(".nav-news").click(function() { TweenMax.to($(window), 1.5, { scrollTo: { y: $(window).height() }, ease: Expo.easeOut } ); }); $(".nav-projects").click(function() { TweenMax.to($(window), 1.5, { scrollTo: { y: $(".project-container").offset().top }, ease: Expo.easeOut } ); }); $(".nav-footprint").click(function() { TweenMax.to($(window), 1.5, { scrollTo: { y: $(".footprint-container").offset().top }, ease: Expo.easeOut } ); }); $togs = false; $(".hamburger").click(function() { if(!$togs) { TweenMax.to($("div#page"), 0.5, { css: { x: 220 } } ); TweenMax.to($("#mobile-navigation .menu-header-menu-container"), 0.5, { css: { x: 220 } } ); $("html").css("overflow-y", "hidden"); $togs = true; } else { TweenMax.to($("div#page"), 0.5, { css: { x: 0 } } ); TweenMax.to($("#mobile-navigation .menu-header-menu-container"), 0.5, { css: { x: 0 } } ); $togs = false; $("html").css("overflow-y", "scroll"); } }); function resetNavStyling() { $(".tiny-nav svg text").css("opacity", 0.2); $(".tiny-nav svg circle").css("fill", "transparent"); } $(window).scroll(function() { var scroll_offset_top = $(window).scrollTop(); TweenMax.to($(".banner"), 0.1, { css: { "top": -(scroll_offset_top / $(window).height()) * 130 } }); banner_pos = -(scroll_offset_top / $(window).height()) * 80; TweenMax.to($(".banner-text-container"), 0.1, { css: { yPercent: banner_pos } }); TweenMax.to($(".banner-text-container"), 0.1, { css: { "opacity": 1 - (scroll_offset_top / ($(window).height() * 0.75)) } }); if(scroll_offset_top < $(window).height()) { resetNavStyling(); $("text.nav-home").css("opacity", 1); $("circle.nav-home").css("fill", "#ffffff"); } if((scroll_offset_top >= $(window).height() * 0.5) && (scroll_offset_top < $(window).height() * 2)) { resetNavStyling(); $("text.nav-news").css("opacity", 1); $("circle.nav-news").css("fill", "#ffffff"); } if((scroll_offset_top >= $(window).height() * 1.5) && (scroll_offset_top < $(window).height() * 3)) { resetNavStyling(); $("text.nav-projects").css("opacity", 1); $("circle.nav-projects").css("fill", "#ffffff"); } if((scroll_offset_top >= $(window).height() * 2.5) && (scroll_offset_top < $(window).height() * 4)) { resetNavStyling(); $("text.nav-footprint").css("opacity", 1); $("circle.nav-footprint").css("fill", "#ffffff"); } }).scroll(); $(function(){ var $window = $(window); //Window object var scrollTime = 0.5; //Scroll time var scrollDistance = 170; //Distance. Use smaller value for shorter scroll and greater value for longer scroll $window.on("mousewheel DOMMouseScroll", function(event){ event.preventDefault(); var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3; var scrollTop = $window.scrollTop(); var finalScroll = scrollTop - parseInt(delta*scrollDistance); TweenMax.to($window, scrollTime, { scrollTo : { y: finalScroll, autoKill:true }, ease: Power1.easeOut, //For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html autoKill: true, overwrite: 5 }); }); }); // home - projects container $slide_index = 0; $(".nav-left").click(function(e) { e.preventDefault(); $(".nav-projects").click(); $slide_index--; if($slide_index < 0) { $slide_index = 0; } else { var tl = new TimelineMax(); tl.to($(".project-title"), 0.5, { autoAlpha: 0 }); tl.to($(".project-location"), 0.5, { autoAlpha: 0 }, "-=0.5"); tl.to($(".view-project"), 0.5, { autoAlpha: 0 }, "-=0.5"); tl.to($(".project-container ul"), 0.5, { x: -$(window).width() * $slide_index }); tl.to($(".project-title"), 0.5, { autoAlpha: 1 }); tl.to($(".project-location"), 0.5, { autoAlpha: 1 }, "-=0.5"); tl.to($(".view-project"), 0.5, { autoAlpha: 1 }, "-=0.5"); } }); $(".nav-right").click(function(e) { e.preventDefault(); $(".nav-projects").click(); $slide_index++; if($slide_index >= $(".project-container li").length) { $slide_index = $(".project-container li").length - 1; } else { var tl = new TimelineMax(); tl.to($(".project-title"), 0.5, { autoAlpha: 0 }); tl.to($(".project-location"), 0.5, { autoAlpha: 0 }, "-=0.5"); tl.to($(".view-project"), 0.5, { autoAlpha: 0 }, "-=0.5"); tl.to($(".project-container ul"), 0.5, { x: -$(window).width() * $slide_index }); tl.to($(".project-title"), 0.5, { autoAlpha: 1 }); tl.to($(".project-location"), 0.5, { autoAlpha: 1 }, "-=0.5"); tl.to($(".view-project"), 0.5, { autoAlpha: 1 }, "-=0.5"); } }); // news/career dropdowns $("body").click(function() { if(parseInt($(".category-dropdown").css("max-height")) > 0) { TweenMax.to($(".category-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".category-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } if(parseInt($(".year-dropdown").css("max-height")) > 0) { TweenMax.to($(".year-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".year-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } }).click(); $(".filter-category").click(function() { if(parseInt($(".category-dropdown").css("max-height")) > 0) { TweenMax.to($(".category-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".category-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } else { TweenMax.to($(".category-dropdown"), 0.2, { css: { "opacity": 1 }, ease: Power1.easeIn }); TweenMax.to($(".category-dropdown"), 0.2, { css: { "max-height": 600 }, ease: Power1.easeIn }); TweenMax.to($(".year-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".year-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } }); $(".filter-year").click(function() { if(parseInt($(".year-dropdown").css("max-height")) > 0) { TweenMax.to($(".year-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".year-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } else { TweenMax.to($(".year-dropdown"), 0.2, { css: { "opacity": 1 }, ease: Power1.easeIn }); TweenMax.to($(".year-dropdown"), 0.2, { css: { "max-height": 306 }, ease: Power1.easeIn }); TweenMax.to($(".category-dropdown"), 0.2, { css: { "opacity": 0 }, ease: Power1.easeIn }); TweenMax.to($(".category-dropdown"), 0.2, { css: { "max-height": 0 }, ease: Power1.easeIn }); } }); $(".filter-category a").click(function(e) { $(".filter-category span").text( $(this).text() ); }); $(".filter-year a").click(function(e) { $(".filter-year span").text( $(this).text() ); }); $("header .search-icon").click(function() { if($(".search-box").css("display") == "none") { $(".search-box").show(); } else { $(".search-box").hide(); } }); // about $(".btn-about-staff").click(function(e) { e.preventDefault(); /* var id = $(this).data('id'); $(".staff-projects").hide(); $(".staff-projects#" + id).show(); */ }); $(".close-about-staff").click(function(e) { e.preventDefault(); /*$(".staff-projects").hide();*/ }); // ------- HOME FOOTPRINT -------- // $(".wa-group, .wa-text").click(function() { window.location = window.location.href + '/projects/wa/'; }); $(".nt-group, .nt-text").click(function() { window.location = window.location.href + '/projects/nt/'; }); $(".qld-group, .qld-text").click(function() { window.location = window.location.href + '/projects/qld/'; }); $(".sa-group, .sa-text").click(function() { window.location = window.location.href + '/projects/sa/'; }); $(".nsw-box, .nsw-text").click(function() { window.location = window.location.href + '/projects/nsw/'; }); $(".act-box, .act-text").click(function() { window.location = window.location.href + '/projects/act/'; }); $(".vic-group, .vic-text").click(function() { window.location = window.location.href + '/projects/vic/'; }); $(".tas-group, .tas-text").click(function() { window.location = window.location.href + '/projects/tas/'; }); // New - Home var intervalID = setInterval(function() { $(".home .vc_gitem-post-meta-field-staff_info_keyprojects").each(function() { $(this).text($(this).text().split(/\s+/).slice(0,21).join(" ") + " ..."); }); $(".vc_gitem-post-data-source-post_excerpt").each(function() { var str = $(this).text(); var res = str.replace("[…]", "..."); $(this).text(res); }); $(".vc_column-inner.vc_custom_1523404870405 .vc_gitem-zone.vc_gitem-zone-a.vc-gitem-zone-height-mode-auto.vc-gitem-zone-height-mode-auto-3-4.vc_gitem-is-link").css("height", $(".vc_column-inner.vc_custom_1523404897661 .vc_grid-container.vc_clearfix.wpb_content_element.vc_basic_grid").height()); }, 1000); setTimeout(function() { clearInterval(intervalID); }, 10000); var intervalID2 = setInterval(function() { $(".linkedin-icon").each(function() { var li_url = $(this).text(); $(this).empty(); $(".vc_custom_1522296270297 .vc_col-sm-4").css("display", "block"); $(this).append(''); }); var old_height = 0; $(".page-id-730 .vc_col-sm-3").each(function() { if($(this).height() > old_height) { old_height = $(this).height(); } }); $(".page-id-730 .vc_col-sm-3, .page-id-730 .vc_col-sm-3 .vc_grid-item-mini").each(function() { $(this).css("height", old_height); }); $(".staff_email_click").each(function() { $html = '' + $(this).text() + '' $(this).html($html); }); $(".vc_carousel-slideline .vc_item").each(function() { $(this).css("position", "relative"); }); $(".vc_carousel-slideline img").each(function() { $(this).css("transform", "translate(0%, -50%)"); $(this).css("position", "absolute"); $(this).css("top", "50%"); $(this).css("width", "100%"); }); if($("body").hasClass("page-id-773")) { var titles = []; var ind = 0; $(".vc_gitem-post-data-source-post_title a").each(function(index) { var title = $(this).attr("title"); titles[index] = title; }); $(".vc_gitem-post-data-source-post_excerpt").each(function() { var str = $(this).text(); var res = str.replace("About the role", ""); $(this).text(res); }); $(".vc_gitem-post-data-source-post_excerpt").each(function(index) { var str = $(this).text(); var current_title = titles[index]; var temp = current_title.replace("–", "-"); // mdash var rep = str.replace(temp, ""); $(this).text(rep); }); $(".vc_gitem-post-data-source-post_excerpt").each(function(index) { var str = $(this).text(); var current_title = titles[index]; // ndash var ren = str.replace(current_title, ""); $(this).text(ren); }); } }, 2000); setTimeout(function() { clearInterval(intervalID2); }, 2000); $(".staff-container a").each(function() { $(this).attr("href", "http://rcapps.com.au/adp/people/"); }); var filter = '@#{}'; var state = false; var type = false; $(".category-state .category-option").click(function(e) { e.preventDefault(); $el = $(this); $(".category-state .category-option").each(function() { $(this).removeClass("filter-selected"); }); $(this).addClass("filter-selected"); if($el.hasClass("all-states")) { state = false; } else { state = true; } if(state == true) { filter = filter.replace(/@.*#/, '@' + $el.data("filter") + '#'); } if(state == false) { filter = filter.replace(/@.*?#/g, '@#'); } $.ajax({ type: "POST", url: content.template_url + "/webservice.php", data: { action: "filter_project", filter: filter }, success: function(d) { $(".grid-3").remove(); $(".page-template-portfolio #primary .std-width").append(d); } }); }); $(".category-construction-type .category-option").click(function(e) { e.preventDefault(); $el = $(this); $(".category-construction-type .category-option").each(function() { $(this).removeClass("filter-selected"); }); $(this).addClass("filter-selected"); if($el.hasClass("all-types")) { type = false; } else { type = true; } if(type == true) { filter = filter.replace(/{.*}/, '{' + $el.data("filter") + '}'); } if(type == false) { filter = filter.replace(/{.*?}/g, '{}'); } $.ajax({ type: "POST", url: content.template_url + "/webservice.php", data: { action: "filter_project", filter: filter }, success: function(d) { $(".grid-3").remove(); $(".no-result").remove(); $(".clr").remove(); $na = "
No project matches your selected criteria
"; if(d != "") { $(".page-template-portfolio #primary .std-width").append(d); } else { $(".page-template-portfolio #primary .std-width").append($na); } } }); }); /* News page */ if($("body").hasClass("single-post")) { $html = ''; $(".share").append($html); } $(".link").click(function() { $html = '