$(document).ready(function() { $('div.learn').click(function() { var pos = $("#home-video").offset().top - 270; $('html, body').animate({ scrollTop: pos }, 1500); }); $('input#term').click(function() { var set = $( "input#term:checked" ).length; if(set === 0) { $('.monthly').hide(); $('.terms-monthly').css({ 'display' : 'none' }); $('.yearly').show(); $('.terms-yearly').css({ 'display' : 'block' }); } else { $('.monthly').show(); $('.terms-monthly').css({ 'display' : 'block' }); $('.yearly,.terms-yearly').hide(); } }); $('a#login').click(function() { var status = $('div#login').attr('rel'); if(status == 'open') { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(250); } else { $('div#login').attr('rel', 'open'); $('div#login').fadeIn(250); } }); if($('.owl-carousel').length) { $(".owl-carousel").owlCarousel({ loop:true, center:true, margin:0, nav:true, items:1, autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true }); } $('#about-founders .left, #about-founders .right').hover(function() { var line = $(this).attr('rel'); if(line == 'faiza') { $('.line').html('.').addClass('faiza').removeClass('jami'); } else { $('.line').html('.').addClass('jami').removeClass('faiza'); } }); var innerWidth = $(window).width(); if(innerWidth <= 768) { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(250); var heightMac = (innerWidth - 40) / 1.680672269; var widthMacVideo = (innerWidth - 40) / 1.318681319; var marginLeftMacVideo = (innerWidth - 40 - widthMacVideo) / 2; var marginTopMacVideo = heightMac * 0.09; $('#home-video .player, #employer-intro .player, #employer-path .video').css( { height : heightMac } ); $('#home-video .player video, #employer .player video, #employer-path .video video').css( { width : widthMacVideo, height : 'auto', 'margin-left' : marginLeftMacVideo, 'margin-top' : marginTopMacVideo } ); var heightPhone = ((innerWidth - 40) * 0.8) * 1.999750708; var widthPhoneVideo = ((innerWidth - 40) * 0.8) * 0.869688385; var marginLeftPhoneVideo = (((innerWidth - 40) * 0.8) - widthPhoneVideo) / 2; var marginTopPhoneVideo = heightPhone * 0.025808375; $('#slync-path .iphone, #slync-path .video, #slync-path .block.first .video, #slync-path .block.third .video, #slync-path .video.right').css( { height : heightPhone } ); $('#slync-path video').css( { width : widthPhoneVideo, 'margin-left' : marginLeftPhoneVideo, 'margin-top' : marginTopPhoneVideo } ); $('#pricing-chart .row').css( { 'padding-left' : 0, 'padding-right' : 0 } ); } else { if($('.paroller').length) { $('.paroller').paroller(); } var bodyID = $('body').attr('id'); if(bodyID == 'pricing') { var rowWidth = $('.row').width(); if(rowWidth < 1200) { var tableWidth = $('#pricing-chart .row').innerWidth(); var tablePadding = (tableWidth / 1200) * 75; if(tablePadding > 75) tablePadding = 75; $('#pricing-chart .row').css( { 'padding-left' : tablePadding, 'padding-right' : tablePadding } ); } } } if($('#about-founders').length) { if(innerWidth > 768) { var ratio = innerWidth / 1200; var adjusted = 425 * ratio; var adjustedWidth = innerWidth / 2; $('#about-founders .row').css( { 'height' : adjusted, 'width' : innerWidth }); $('#about-founders .row div.left, #about-founders .row div.right').css( { 'height' : adjusted, 'width' : adjustedWidth } ); } } if($('.owl-carousel').length) { var dotsWidth = $('.owl-dots').width(); var buttonWidth = $('.owl-dots button').width(); var buttonCount = $('.owl-dots button').length; var buttonsWidth = buttonWidth * buttonCount; var leftMargin = (dotsWidth - buttonsWidth) / 2; $('.owl-dots button:first-of-type').css({ 'margin-left' : leftMargin }); } }); tippy('a[rel=tooltip]', { arrow: true, arrowType: 'round', placement: 'right', }); var hoverOver = ""; var vid = document.getElementById("video-home"); if(vid !== null) { vid.ontimeupdate = function() { vidTimer() }; function vidTimer() { if(vid.currentTime >= 0 && vid.currentTime < 19) { // Newsfeed document.getElementById("newsfeed").setAttribute('class', 'selected'); if (hoverOver != "cv") { document.getElementById("cv").setAttribute('class', ''); } document.getElementById("boost").setAttribute('class', ''); if (hoverOver != "listing") { document.getElementById("listing").setAttribute('class', ''); } document.getElementById("video").setAttribute('class', ''); } else if(vid.currentTime >= 19 && vid.currentTime < 32) { // CV document.getElementById("newsfeed").setAttribute('class', ''); document.getElementById("cv").setAttribute('class', 'selected'); document.getElementById("boost").setAttribute('class', ''); if (hoverOver != "listing") { document.getElementById("listing").setAttribute('class', ''); } document.getElementById("video").setAttribute('class', ''); } else if(vid.currentTime >= 32 && vid.currentTime < 49) { // Boost document.getElementById("newsfeed").setAttribute('class', ''); if (hoverOver != "cv") { document.getElementById("cv").setAttribute('class', ''); } document.getElementById("boost").setAttribute('class', 'selected'); if (hoverOver != "listing") { document.getElementById("listing").setAttribute('class', ''); } document.getElementById("video").setAttribute('class', ''); } else if(vid.currentTime >= 49 && vid.currentTime < 64) { // Video document.getElementById("newsfeed").setAttribute('class', ''); if (hoverOver != "cv") { document.getElementById("cv").setAttribute('class', ''); } document.getElementById("boost").setAttribute('class', ''); if (hoverOver != "listing") { document.getElementById("listing").setAttribute('class', ''); } document.getElementById("video").setAttribute('class', 'selected'); } else if(vid.currentTime >= 64 && vid.currentTime <= 85) { // Listing document.getElementById("newsfeed").setAttribute('class', ''); if (hoverOver != "cv") { document.getElementById("cv").setAttribute('class', ''); } document.getElementById("boost").setAttribute('class', ''); document.getElementById("listing").setAttribute('class', 'selected'); document.getElementById("video").setAttribute('class', ''); } if (hoverOver != "") { document.getElementById(hoverOver).setAttribute('class', 'selected'); } if ($("#cv").hasClass("selected")) { $("#cv_icon_off").attr('display', 'none'); $("#cv_icon_on").attr('display', 'inline'); } else { $("#cv_icon_on").attr('display', 'none'); $("#cv_icon_off").attr('display', 'inline'); } if ($("#listing").hasClass("selected")) { $("#listing_icon_off").attr('display', 'none'); $("#listing_icon_on").attr('display', 'inline'); } else { $("#listing_icon_on").attr('display', 'none'); $("#listing_icon_off").attr('display', 'inline'); } } $( "ul.clips li#cv" ).hover( function() { hoverOver = "cv"; }, function() { hoverOver = ""; } ); $( "ul.clips li#listing" ).hover( function() { hoverOver = "listing"; }, function() { hoverOver = ""; } ); $('ul.clips li').click(function() { var clicked = $(this).attr('id'); $('ul.clips li').removeClass('selected'); if(clicked == 'newsfeed') { vid.currentTime = 0; $('ul.clips li#newsfeed').addClass('selected'); } else if(clicked == 'cv') { vid.currentTime = 19; $('ul.clips li#cv').addClass('selected'); } else if(clicked == 'boost') { vid.currentTime = 32; $('ul.clips li#boost').addClass('selected'); } else if(clicked == 'video') { vid.currentTime = 49; $('ul.clips li#video').addClass('selected'); } else if(clicked == 'listing') { vid.currentTime = 64; $('ul.clips li#listing').addClass('selected'); } }); } $(window).scroll(function (event) { var scroll = $(window).scrollTop(); var innerWidth = window.innerWidth; var bodyID = $('body').attr('id'); if(bodyID != 'slync') { if(innerWidth > 768) { if(bodyID == 'employer' || bodyID == 'onboarding') { if(scroll <= 10) { $('div#login').attr('rel', 'open'); $('div#login').fadeIn(250); } else { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(250); } // else } else { if(scroll <= 300) { $('div#login').attr('rel', 'open'); $('div#login').fadeIn(250); } else { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(250); } // else } } else { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(0); } } }); $(function(){ activate('img[src*=".svg"]'); function activate(string){ jQuery(string).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'); }); } }); $(window).bind('resize',function() { var browserWidth = $(window).width(); if(browserWidth <= 768) { $('div#login').attr('rel', 'closed'); $('div#login').fadeOut(250); var heightMac = (browserWidth - 40) / 1.680672269; var widthMacVideo = (browserWidth - 40) / 1.318681319; var marginLeftMacVideo = (browserWidth - 40 - widthMacVideo) / 2; var marginTopMacVideo = heightMac * 0.09; $('#home-video .player, #employer-intro .player, #employer-path .video').css( { height : heightMac }); $('#home-video .player video, #employer .player video, #employer-path .video video').css( { width : widthMacVideo, height : 'auto', 'margin-left' : marginLeftMacVideo, 'margin-top' : marginTopMacVideo }); var heightPhone = ((browserWidth - 40) * 0.8) * 1.999750708; var widthPhoneVideo = ((browserWidth - 40) * 0.8) * 0.869688385; var marginLeftPhoneVideo = (((browserWidth - 40) * 0.8) - widthPhoneVideo) / 2; var marginTopPhoneVideo = heightPhone * 0.025808375; $('#slync-path .iphone, #slync-path .video, #slync-path .block.first .video, #slync-path .block.third .video, #slync-path .video.right').css( { height : heightPhone } ); $('#slync-path video').css( { width : widthPhoneVideo, 'margin-left' : marginLeftPhoneVideo, 'margin-top' : marginTopPhoneVideo } ); $('#pricing-chart .row').css( { 'padding-left' : 0, 'padding-right' : 0 } ); } else { var bodyID = $('body').attr('id'); if(bodyID == 'pricing') { var rowWidth = $('.row').width(); if(rowWidth < 1200) { var tableWidth = $('#pricing-chart .row').innerWidth(); var tablePadding = (tableWidth / 1200) * 75; if(tablePadding > 75) tablePadding = 75; $('#pricing-chart .row').css( { 'padding-left' : tablePadding, 'padding-right' : tablePadding } ); } } $('#home-video .player, #employer-intro .player').css( { height : 435 }); $('#home-video .player video').css( { width : 415, height : 'auto', 'margin-left' : 16, 'margin-top' : 16 }); $('#employer .player video').css( { width : 415, height : 'auto', 'margin-left' : 1, 'margin-top' : 16 }); $('#employer-path .video').css( { height : 392 }); $('#employer-path .video video').css( { width : 371, height : 'auto', 'margin-left' : 16, 'margin-top' : 17 }); $('#slync-path .iphone, #slync-path .video, #slync-path .block.first .video, #slync-path .block.third .video, #slync-path .video.right').css( { height : 500 } ); $('#slync-path video').css( { width : 264, 'margin-left' : 19, 'margin-top' : 58 } ); } if($('#about-founders').length) { if(browserWidth > 768) { var ratio = browserWidth / 1200; var adjusted = 425 * ratio; var adjustedWidth = browserWidth / 2; $('#about-founders .row').css( { 'height' : adjusted, 'width' : browserWidth }); $('#about-founders .row div.left, #about-founders .row div.right').css( { 'height' : adjusted, 'width' : adjustedWidth } ); } else { $('#about-founders .row').css( { height : 780, width : browserWidth }); $('#about-founders .row div.left, #about-founders .row div.right').css( { 'height' : 390, 'width' : browserWidth } ); } } if($('.owl-carousel').length) { var dotsWidth = $('.owl-dots').width(); var buttonWidth = $('.owl-dots button').width(); var buttonCount = $('.owl-dots button').length; var buttonsWidth = buttonWidth * buttonCount; var leftMargin = (dotsWidth - buttonsWidth) / 2; $('.owl-dots button:first-of-type').css({ 'margin-left' : leftMargin }); } });