Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;(function($){
- $(function(){
- // Begin input common focus and blur for value.
- var input = $('input:text, input:password,input[type="email"],input[type="tel"],input[type="number"],input[type="search"], textarea');
- $(input).each(function () {
- var inputText = $(this).attr('placeholder')
- $(this).focus(function () {
- if ($(this).val().length === 0) {
- $(this).attr('placeholder', '');
- $('.input-wrap').removeClass('value-added')
- }
- }).blur(function () {
- if ($(this).val().length === 0) {
- $(this).attr('placeholder', inputText);
- $(this).parent().removeClass('active');
- } else if ($(this).val().length > 0) {
- $(this).parent().addClass('active');
- }
- })
- });
- $('div.input-wrap input').keyup(function(){
- $(this).parents(".input-wrap").addClass('value-added')
- })
- /* $('div.text-field input').blur(function(){
- if(!this.value){this.value=this.defaultValue;}
- if(this.value==this.defaultValue){
- $('div.header-search').removeClass('value-added')
- }
- });*/
- // Ends input common focus and blur for value.
- // Phone nav click function
- $('#phone-nav').click(function(){
- $("body").toggleClass("navShown");
- $(".nav-wrap").slideToggle();
- $(".main-nav ul li.hasNav").find("> ul:visible").slideUp()
- });
- if($(".top-bg").length){
- $("body").addClass("topShown")
- $(window).on("scroll", function () {
- var fromTop = $(window).scrollTop();
- {
- $("header").addClass("blkheader")
- }
- });
- }
- if($(".bg-grey").length){
- $("header").addClass("greyheader");
- $("body").addClass("greyBody");
- }
- $(".main-nav ul li").find(">ul").parents("li").addClass("hasNav")
- if($(window).width() < 992){
- $(".main-nav ul li.hasNav > a").bind('click', 'touchend', function(e){
- e.preventDefault();
- $(".main-nav ul li.hasNav").find("> ul:visible").slideUp()
- $(".main-nav ul li.hasNav").removeClass("active")
- if($(this).parent().find("> ul:visible").length){
- $(this).removeClass("active")
- $(this).parent().find("> ul").slideUp()
- }
- else{
- $(this).addClass("active")
- $(this).parent().find("> ul").slideDown()
- }
- });
- }
- if($('select.stylled-select').length){
- $("select.stylled-select").selectric()
- }
- if ($(window).width() > 768) {
- var $header = $("header"),
- $clone = $header.addClass("fixedBorder"),
- $fixedHeader = $('.fixedBorder'),
- $headerHeight = $fixedHeader.outerHeight(),
- lastPos = 0;
- $(window).resize(function () {
- $headerHeight = $fixedHeader.outerHeight();
- });
- $(window).on("scroll", function () {
- $fixedHeader.removeClass('onSizing');
- var fromTop = $(window).scrollTop();
- if (fromTop > $headerHeight ) {
- $fixedHeader.css('top', '0');
- $("body").addClass("started");
- if (fromTop > lastPos) {
- $fixedHeader.css({
- top: 0
- });
- }
- lastPos = fromTop;
- } else {
- $fixedHeader.css('top', '0');
- $("body").removeClass("started");
- }
- });
- }
- if($("#hero-slider-wrap").length){
- $("#hero-slider-wrap").slick({
- infinite: true,
- arrows: true,
- dots: false,
- autoplay: false,
- speed: 1000,
- fade:true,
- });
- //ticking machine
- var percentTime;
- var tick;
- var time = 1;
- var progressBarIndex = 0;
- $('.progressBarContainer .progressBar').each(function(index) {
- var progress = "<div class='inProgress inProgress" + index + "'></div>";
- $(this).html(progress);
- //$(this).parent().addClass("active");
- });
- function startProgressbar() {
- resetProgressbar();
- percentTime = 0;
- tick = setInterval(interval, 10);
- $(".slider-controler ul li").removeClass("active")
- }
- function interval() {
- if (($('#hero-slider-wrap .slick-track div[data-slick-index="' + progressBarIndex + '"]').attr("aria-hidden")) === "true") {
- progressBarIndex = $('#hero-slider-wrap .slick-track div[aria-hidden="false"]').data("slickIndex");
- startProgressbar();
- } else {
- percentTime += 1 / (time + 5);
- $('.inProgress' + progressBarIndex).css({
- width: percentTime + "%"
- });
- $('.inProgress' + progressBarIndex).parents("li").addClass("active")
- if (percentTime >= 100) {
- $('#hero-slider-wrap').slick('slickNext');
- progressBarIndex++;
- if (progressBarIndex > 2) {
- progressBarIndex = 0;
- }
- startProgressbar();
- }
- }
- }
- function resetProgressbar() {
- $('.inProgress').css({
- width: 0 + '%'
- });
- clearInterval(tick);
- }
- startProgressbar();
- // End ticking machine
- $('.progressBarContainer ul li').click(function () {
- clearInterval(tick);
- var goToThisIndex = $(this).find("span").data("slickIndex");
- $('#hero-slider-wrap').slick('slickGoTo', goToThisIndex, false);
- startProgressbar();
- });
- }
- if($(window).width() > 767){
- if($("#timeline").length){
- $('.timeline-controller ul li').eq(0).addClass('active');
- $("#timeline").slick({
- infinite: true,
- arrows: false,
- dots: false,
- autoplay: false,
- centerMode:false,
- draggable:true,
- speed: 800,
- slidesToScroll: 1,
- slidesToShow: 3,
- responsive: [
- {
- breakpoint: 600,
- settings: {
- slidesToShow: 1,
- slidesToScroll: 1,
- initialSlide: 1
- }
- },
- {
- breakpoint: 480,
- settings: {
- slidesToShow: 1,
- slidesToScroll: 1
- }
- }
- ]
- });
- $('#timeline').on('afterChange', function (event, slick, currentSlide, nextSlide) {
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').removeClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(currentSlide).addClass('active');
- $(this).find(".slick-slide").eq(nextSlide).addClass('got');
- menuActiveState();
- });
- $('.timeline-details-section').each(function (i) {
- var item = $(this).find('.timeline-controller ul li');
- item.each(function (i) {
- $(this).click(function () {
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').removeClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(i).addClass('active');
- $(this).parents('.timeline-details-section').find('#timeline').slick('slickGoTo', (i + 1) - 1);
- })
- })
- });
- }
- function menuActiveState() {
- var $line = $('.marker'),
- $nav = $('.timeline-controller'),
- timerNav,
- animLine = function ($target) {
- var offsetConteneur = $nav.offset().left,
- largeur = $target.outerWidth(),
- posX1 = $target.offset().left - offsetConteneur,
- posX2 = $target.offset().left + largeur - offsetConteneur;
- TweenMax.to($line, 0.8, {css:{left: posX1}, ease:Power4.easeOut});
- };
- if ($('.timeline-controller ul').length) {
- setTimeout(
- function () {
- animLine($nav.find('.active'));
- }, 500
- );
- $nav.find('li').click(function (event) {
- clearTimeout(timerNav);
- animLine($(this));
- })
- }
- }
- menuActiveState();
- }
- if($(window).width() < 768){
- $('#timeline').on('afterChange', function (event, slick, currentSlide, nextSlide) {
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').removeClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(currentSlide).addClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(1).addClass('shown');
- });
- $('.timeline-details-section').each(function (i) {
- var item = $(this).find('.timeline-controller ul li');
- item.each(function (i) {
- $(this).click(function () {
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').removeClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(i).addClass('active');
- $(this).parents('.timeline-details-section').find('.timeline-controller ul li').eq(1).removeClass('shown');
- $(this).parents('.timeline-details-section').find('#timeline').slick('slickGoTo', (i + 1) - 1);
- })
- })
- });
- $("#timeline").slick({
- infinite: true,
- arrows: false,
- dots: false,
- autoplay: false,
- centerMode:true,
- speed: 800,
- centerPadding:'0',
- draggable:false,
- slidesToScroll: 1,
- slidesToShow: 1,
- asNavFor:"#timeline-controlled"
- });
- var $progressBar = $('.progressed');
- $("#timeline-controlled").slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- draggable:false,
- arrows:true,
- speed: 800,
- infinite:true,
- asNavFor: "#timeline"
- }).on('beforeChange', function (event, slick, currentSlide, nextSlide) {
- var calc = ((nextSlide) / (slick.slideCount - 1)) * 100;
- $progressBar
- .css('background-size', calc + '% 100%')
- .attr('aria-valuenow', calc);
- });
- }
- // function workCarousel(){
- // //var slideCount = null;
- // var totalSlideNumber = 0;
- // $('.carousel-wrap .propertise-item').each(function(i){
- // totalSlideNumber = i + 1;
- // totalSlideNumber < 10 ? totalSlideNumber = '0' + totalSlideNumber : totalSlideNumber;
- // });
- // $('.counter-info .current' ).text('01');
- // }
- // workCarousel();
- if($("#top-carousel").length){
- var totalSlide = $('#top-carousel .top-carousel-item').length;
- $('.top-carousel span.total').text(totalSlide);
- $('#top-carousel').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- dots: false,
- speed: 400,
- infinite: true,
- arrows: true,
- });
- }
- $('#top-carousel').on('beforeChange', function(event, slick, currentSlide, nextSlide) {
- var getNumber = nextSlide + 1;
- getNumber < 10 ? getNumber = '0' + getNumber : getNumber;
- $('.counter-info .current' ).text(getNumber);
- });
- $('.Next').each(function(){
- var $_this = $(this);
- $_this.on('click', function(){
- $_this.parents('.carousel-item-wrap').find('.slick-next').trigger('click');
- });
- })
- $('.Previous').each(function(){
- var $_this = $(this);
- $_this.on('click', function(){
- $_this.parents('.carousel-item-wrap').find('.slick-prev').trigger('click');
- })
- })
- $('.Next').each(function(){
- $('.Next').on('click', function(){
- $(this).parents('.top-carousel').find('.slick-next').trigger('click');
- })
- })
- $('.Previous').each(function(){
- $('.Previous').on('click', function(){
- $(this).parents('.top-carousel').find('.slick-prev').trigger('click');
- })
- })
- if($(window).width () < 768){
- $('#propertise-wrap').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- dots: false,
- speed: 400,
- arrows:true,
- centerMode:true,
- infinite: true,
- });
- $(window).on('resize', function () {
- $('#propertise-wrap').slick('resize');
- });
- }
- function Fullcarousel(){
- //var slideCount = null;
- var totalNumber = 0;
- $('.carousel-wrap .propertise-item').each(function(i){
- totalNumber = i + 1;
- totalNumber < 10 ? totalNumber = '0' + totalNumber : totalNumber;
- });
- $('.counter-info .current' ).text('01');
- }
- Fullcarousel();
- if($('.carousel-wrap').length){
- $('.carousel-wrap').each(function(){
- var _this = $(this);
- var totalNumber = _this.find('.propertise-item').length;
- var setZero = totalNumber < 10 ? totalNumber = '0' + totalNumber : totalNumber;
- _this.parents(".carousel-item-wrap").find('.counter-info .total' ).text(setZero);
- _this.on("init", function(event, slick, slideIndex){
- var currentIndex = _this.parents(".carousel-item-wrap").find('.slick-current').attr('data-slick-index');
- if(currentIndex == 0){
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").addClass("disable");
- }else{
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").removeClass("disable");
- }
- });
- _this.slick({
- slidesToShow:3,
- slidesToScroll: 1,
- dots: false,
- speed: 400,
- infinite: true,
- arrows:true,
- variableWidth: true,
- responsive: [
- {
- breakpoint: 1025,
- settings: {
- slidesToShow:2,
- slidesToScroll: 1,
- variableWidth: false
- }
- },
- {
- breakpoint: 600,
- settings: {
- slidesToShow: 1,
- slidesToScroll: 1
- }
- },
- {
- breakpoint: 480,
- settings: {
- slidesToShow: 1,
- slidesToScroll: 1,
- variableWidth: false
- }
- }
- ]
- }).on('beforeChange', function(event, slick, currentSlide, nextSlide, slideIndex) {
- var getNumberCaruosel = nextSlide + 1;
- getNumberCaruosel < 10 ? getNumberCaruosel = '0' + getNumberCaruosel : getNumberCaruosel;
- _this.parents(".carousel-item-wrap").find('.counter-info .current' ).text(getNumberCaruosel);
- }).on('afterChange', function(event, slick, currentSlide, nextSlide, slideIndex) {
- var currentIndex = _this.parents(".carousel-item-wrap").find('.slick-current').attr('data-slick-index');
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").removeClass("disable");
- _this.parents(".carousel-item-wrap").find(".counter-info .Next").removeClass("disable");
- if(currentIndex == totalNumber - 1){
- _this.parents(".carousel-item-wrap").find(".counter-info .Next").addClass("disable");
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").removeClass("disable");
- }
- if(currentIndex == 0){
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").addClass("disable");
- }else{
- _this.parents(".carousel-item-wrap").find(".counter-info .Previous").removeClass("disable");
- }
- });
- // Hides navigation when less than 3
- // if($(window).width() > 1024){
- // if(totalNumber <= 3){
- // $(".counter-info-wrap").hide();
- // }else{
- // $(".counter-info-wrap").show();
- // }
- // }
- })
- }
- // offset scroll on blog
- setTimeout(function() {
- if (location.hash) {
- /* we need to scroll to the top of the window first, because the browser will always jump to the anchor first before JavaScript is ready, thanks Stack Overflow: http://stackoverflow.com/a/3659116 */
- window.scrollTo(0, 0);
- target = location.hash.split('#');
- smoothScrollTo($('#'+target[1]));
- }
- }, 1);
- // taken from: https://css-tricks.com/snippets/jquery/smooth-scrolling/
- $('a[href*=\\#]:not([href=\\#])').click(function() {
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
- smoothScrollTo($(this.hash));
- return false;
- }
- });
- function smoothScrollTo(target) {
- target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
- if (target.length) {
- $('html,body').animate({
- scrollTop: target.offset().top - 150
- }, 1000);
- }
- }
- var $animation_elements = $('.animate');
- var $window = $(window);
- function check_if_in_view() {
- var window_height = $window.height();
- var window_top_position = $window.scrollTop();
- var window_bottom_position = (window_top_position + window_height);
- $.each($animation_elements, function () {
- var $element = $(this);
- var element_height = $element.outerHeight();
- var element_top_position = $element.offset().top;
- var element_bottom_position = (element_top_position + element_height);
- //check to see if this current container is within viewport
- if (element_top_position <= window_bottom_position) {
- $element.addClass('in-view');
- } else {
- $element.removeClass('in-view');
- }
- });
- }
- $window.on('scroll resize', check_if_in_view);
- $window.trigger('scroll');
- // Begin input common focus and blur for value.
- $('input, textarea').keyup(function () {
- $(this).parents(".input-wrap").addClass('populated');
- })
- $('input, textarea').blur(function (){
- if (!this.value){
- this.value = this.defaultValue;
- }
- if (this.value == this.defaultValue){
- $(this).parents(".input-wrap").removeClass('populated');
- }
- });
- })// End ready function.
- })(jQuery)
- //Quad, Cubic, Quart, Quint, Sine, Expo, Circ, Elastic, Back, Bounce
- jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;if(!g)g=e*.3*1.5;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;if((b/=e/2)<1)return d/2*b*b*(((f*=1.525)+1)*b-f)+c;return d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){if((b/=e)<1/2.75){return d*7.5625*b*b+c}else if(b<2/2.75){return d*(7.5625*(b-=1.5/2.75)*b+.75)+c}else if(b<2.5/2.75){return d*(7.5625*(b-=2.25/2.75)*b+.9375)+c}else{return d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}},easeInOutBounce:function(a,b,c,d,e){if(b<e/2)return jQuery.easing.easeInBounce(a,b*2,0,d,e)*.5+c;return jQuery.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement