jQuery(function($) { custom_cursor() //menu_hover_line(); main_contact_motion(); // cursor custom function custom_cursor(){ if( $('html').hasClass('mobile') || $('html').hasClass('ie10') ) { return; } var $cursor_primary = $('#custom-cursor'); var $cursor_secondary = $('#custom-cursor__text'); var $circle = $cursor_primary.find('.custom-cursor__circle'); var $txt = $cursor_secondary.find('.custom-cursor__txt'); // default moving $('body').mousemove(function(e) { TweenMax.to($cursor_primary, 1.3, {x: e.clientX,y: e.clientY,ease: Power3.easeOut}); TweenMax.to($cursor_secondary, 1.6, {x: e.clientX,y: e.clientY,ease: Power3.easeOut}); }); // default hover cursor $(document).on({ mouseenter: function(){ var $this = $(this); var words = ( $this.data('hover') != undefined ) ? $this.data('hover') : ''; var size = ( $this.data('size') != undefined ) ? $this.data('size') : '100%'; var type = ( $this.data('type') != undefined ) ? $this.data('type') : ''; var bgColor = ""; var txtColor = ""; var opacity = ""; if( $this.hasClass('custom-hover--drag') ){ $cursor_primary.addClass('custom-hover--drag'); $cursor_secondary.addClass('custom-hover--drag'); } if( $this.hasClass('custom-hover--plus') ){ $cursor_primary.addClass('custom-hover--plus'); $cursor_secondary.addClass('custom-hover--plus'); } // color setting bgColor = "#fff"; txtColor = "#222"; opacity = 0.8 if(type == "dark"){ bgColor = "#222"; txtColor = "#fff"; opacity = 1 } $txt.find('> span').text( words ); TweenMax.killTweensOf($circle); TweenMax.killTweensOf($txt); TweenMax.to($circle, .3, {width: size,height: size, autoAlpha: opacity,backgroundColor: bgColor,ease: Power0.easeNone}); TweenMax.to($txt, .3, {width: size,height: size,color: txtColor,autoAlpha: 1,ease: Power0.easeNone}); }, mouseleave: function(){ var $this = $(this); if( $this.hasClass('custom-hover--drag') ){ $cursor_primary.removeClass('custom-hover--drag'); $cursor_secondary.removeClass('custom-hover--drag'); } if( $this.hasClass('custom-hover--plus') ){ $cursor_primary.removeClass('custom-hover--plus'); $cursor_secondary.removeClass('custom-hover--plus'); } TweenMax.killTweensOf($circle); TweenMax.killTweensOf($txt); TweenMax.to($circle, .2, {width: '0%',height: '0%',autoAlpha: 0,ease: Power0.easeNone}); TweenMax.to($txt, .2, {width: '0%',height: '0%',autoAlpha: 0,ease: Power0.easeNone}); } }, '.custom-hover'); } function main_contact_motion(){ if( !$('.main-contact').length ){ return; } var $bg = $('.main-contact__bg'); var bottomTop = $bg.attr('data-bottom-top'); var topBottom = $bg.attr('data-top-bottom'); var $title = $('.main-contact__message'); var $link = $('.main-contact__link'); gsap.fromTo($bg,{ width: bottomTop, },{ width: topBottom, ease: "none", scrollTrigger : { trigger: '.main-contact', start: '80% bottom', end: 'top 20%', //scrub : 1, onEnter:function(){ $('.main-contact__content').addClass('motion-loaded') }, //onLeaveBack:function(){ $('.main-contact__content').removeClass('motion-loaded') }, } }); function text_motion(){ TweenMax.fromTo($title, 0.3, {y: 50,autoAlpha:0,ease: Power3.easeOut,delay: 0.3}, { y: 0,autoAlpha:1,delay: 0}); TweenMax.fromTo($link, 0.3, {y: 30,autoAlpha:0,ease: Power3.easeOut,delay: 0.5}, { y: 0,autoAlpha:1,delay: 0}); } } }); // End jQuery