Initiatives focus on societal challenges that are too complex for any one discipline or industry to solve alone.
'); this.stickyWrap = $('
'); var container = $(".site-header").parents('.grid-framework'); $( '.universal-banner, .site-header' ).each( function( index, element ) { this.stickyWrap.append( $( element ).clone() ); $( element ).addClass( 'sticky-header-cloned' ); }.bind( this ) ); this.sticky.append(this.stickyWrap); $(".sticky-header-container").append(this.sticky); } StickyHeader.prototype.triggerDisappear = function(){ this.sticky.addClass('at-scroll-top'); this.isVisible = false; this.currentHeight = 0; this.sticky.css('height',this.currentHeight); $("body").removeClass("sticky-header-active"); $("body").removeClass('sticky-header-expanded'); } StickyHeader.prototype.triggerAppear = function(){ if ($("body").hasClass('slider-is-open')) return; this.isVisible = true; $("body").addClass("sticky-header-active"); } StickyHeader.prototype.triggerExpand = function(){ if (this.disabled) return; if ($("body").hasClass('slider-is-open')) return; if (this.currentHeight == this.maxHeight) return; this.sticky.css('height',this.maxHeight-1); this.currentHeight = this.maxHeight; $("body").addClass('sticky-header-expanded'); } StickyHeader.prototype.triggerShrink = function(){ if ($( '.ua-mobile, .ua-tablet' ).length == 0 || !$(".page-header").hasClass('page-header-online')) { this.sticky.removeClass('at-scroll-top'); } var self = this; window.requestAnimationFrame(function(){ var newHeight = 0; if (self.isVisible) { newHeight = self.minHeight; } if (self.currentHeight == newHeight) return; self.sticky.css('height',newHeight); self.currentHeight = newHeight; $("body").removeClass('sticky-header-expanded'); }) } StickyHeader.prototype.redraw = function() { // This is costly to performance but unavoidable //const pageY = window.scrollY; //This throws a syntax error in IE11. var pageY = window.pageYOffset; var scrollUp = pageY 10) { this.velocitySamples.shift(); } var totalDistance = 0; for (var i = 0;i' + k + ': '+v +''; }) this.debug.html(html); if (pageY >= this.appearsAt) { this.triggerAppear(); } if ($(".page-header").hasClass('page-header-online') && $('.table-of-contents-wrapper').length && $('.table-of-contents-wrapper.jump-to').length == 0){ var tocWrap = $('.table-of-contents-wrapper'); var toc = tocWrap.children('.table-of-contents'); var tocItems = toc.find('.toc-item'); var stickyHeight = this.maxHeight; if ((pageY + stickyHeight) > tocWrap.offset().top && !toc.hasClass('sticky')) { toc.addClass('sticky'); } else if ((pageY + stickyHeight) sectionTop) && !$(this).hasClass('current')) { tocItems.removeClass('current'); $(this).addClass('current'); } else if ((pageHeight 5 || pageY this.appearsAt) { // If HBS online and mobile hide the sticky header if ($(".page-header").hasClass('page-header-online') && $( '.ua-mobile, .ua-tablet' ).length > 0) { this.triggerDisappear(); } this.triggerShrink(); } this.lastScrollTop = pageY; } this.hasScrolled = false; }; var _domready = _domready || []; _domready.push(function(){ if (document.getElementById('wcm-react-root')) return; if (window.stickyHeaderDisabled) return; window.stickyHeader = new StickyHeader(); var _onScroll = function () { if (!window.stickyHeader.hasScrolled) { window.requestAnimationFrame(function(){ window.stickyHeader.redraw(); }); } window.stickyHeader.hasScrolled = true; window.requestAnimationFrame(_onScroll); }; _onScroll(); //without this, the header flickers on online window.setTimeout(function(){ _onScroll(); },250) $(document).on('delay-sticky-nav',function(){ window.stickyHeader.temporarilyDisabled(); }) // needed for facet pages http://www.hbs.edu/news/Pages/default.aspx $(document).on('click',".facetctrl-sticky.active",function(){ $(document).trigger('delay-sticky-nav'); }) $(document).on('click',".filter-sticky.fixed",function(){ $(document).trigger('delay-sticky-nav'); }) }); jQuery(function($){ $('.utility-menu li.has-submenu').each(function(){ var $menu = $(this); $menu.open = function(){ console.log('menu open'); $menu.addClass("open").attr('aria-expanded', "true"); $('.utility-menu li.has-submenu.open').each(function(){ if ($menu[0] !== this) { $(this).removeClass('open').attr('aria-expanded', "false"); } }) } $menu.close = function(){ if ($menu.hasClass('open')) { $menu.removeClass('open').attr('aria-expanded', "false"); } } $menu.on("mouseover", function(event){ $menu.open(); clearTimeout($menu.data('timer')); }); $menu.on("mouseout", function(event){ $menu.data('timer',setTimeout(function(event){ $menu.close(); console.log("mouseout"); }, 500)) }); $menu.on('click',' > a',function(){ var $link = $(this); var $parent = $link.parent() console.log($parent) if ($parent.hasClass('has-submenu') && $parent.hasClass('open') && $(this).hasClass('dropdown-link')) { $menu.close(); return true; } else if ($parent.hasClass('has-submenu') && !$parent.hasClass('open')) { console.log("menu open"); console.log($parent.hasClass('open')); $menu.open(); } else { console.log("menu closed"); console.log($parent.hasClass('open')); $menu.close(); } event.preventDefault(); return false; }) $menu.on('keyup', ' > div', function(event){ if (framework.accessibleClick(event) === true) { if ($(this).parent().hasClass('open')) { $menu.close(); } else { $menu.open(); } return false; } }); $menu.on('keypress', ' > div', function(event){ if (framework.accessibleClick(event) === true) { event.preventDefault(); } }); $("a",$menu).each(function(){ var $link = $(this); $link.on('focus',function(){ clearTimeout($menu.data('timer2')); }) $link.on('blur',function(){ clearTimeout($menu.data('timer2')); $menu.data('timer2',setTimeout(function(event){ $menu.close(); },100)); }) }) }) $(document).on('click', '.utility-menu [data-target]', function(e) { e.preventDefault(); var $utilSubmenu = $(this).parents('.has-submenu'); var utilSubmenuID = $utilSubmenu.attr('id'); var targetElem = $(this).data('target'); $.ajax({ url: $(this).attr('href'), type: 'GET', beforeSend: function() { if ($utilSubmenu.hasClass('open')) { $utilSubmenu.removeClass('open').attr('aria-expanded', "false"); } var minHeight = $('#' + targetElem).outerHeight(); $('#' + targetElem).replaceWith('
Loading...
'); }, success: function(data){ $utilSubmenu.html($(data).find('#' + utilSubmenuID).html()); $('.loading-replace').replaceWith($(data).find('#' + targetElem)); } }); }); }); jQuery(function($){ $(".hero-story .fade-in.in-viewport-trigger").one('framework.responsive-in-viewport',function(){ $(this).addClass('animate') }) }) jQuery(function(){ if ($(".ua-touch").length) return; $(".hero-header").hover(function(){ $(this).addClass('hover'); $('#repaint').remove(); // force repaint $('html').append('.'); // force repaint },function(){ $(this).removeClass('hover'); $('#repaint').remove(); // force repaint }) }) require(['https://d1gfwsbop52idw.cloudfront.net/static/libs/smartquotes/2.3.1/smartquotes.min.js'],function(smartquotes){ $(".text-feature").each(function(){ smartquotes(this); }) }) jQuery(function($){ function oneline(){ $(".one-line").each(function(){ var h = $(this).height(); $(this).css('white-space','nowrap'); var nowraph = $(this).height(); $(this).css('white-space','normal'); console.log(h + ' ' + nowraph) var original = $(this).data('original'); var abbr = $(this).data('abbreviated'); if (h > nowraph) { $(this).html($(this).html().replace(original,abbr)); } else { $(this).html($(this).html().replace(abbr,original)); } }) } $(window).on("load", function(){ oneline(); }) }); $( document ).ready(function() { var trigger = $('a[href="#bei-sign-up-modal"].modal-link'); $(trigger).click(function(e) { e.preventDefault(); var ID = $(this).data("id"); var dlg = new framework.Dialog({ body: $('#' + 'bei-sign-up-modal').html(), title: 'Sign up for our newsletter', width: '500px', caller: e.target, id: ('bei-sign-up-modal' + '-my-form-popup'), backgroundColor: "white" }); dlg.open(); console.log('modal open ' + ID); }); }); $(".form-container .btn-submit").on("click",function(event){ if ($('input#prevent-s').val().length != 0) { return false; } }); $(".custom-submit-link").click(function(event){ if ($('input#prevent-s').val().length != 0) { return false; } event.preventDefault(); $(".btn-submit:submit").trigger("click"); }); $("input[type='radio'], input[type='checkbox']").click(function() { var inputClass = $(this).attr('name') + '-other'; console.log(this); console.log(inputClass); if($(this).val() == "Other" || $(this).hasClass("text-input")) { $("." + inputClass).show(); $("." + inputClass + " input").addClass("required"); } else { $("." + inputClass).hide(); $("." + inputClass + " input").removeClass("required"); } }); $('.trigger-email-popup').click(function(e){ var cururl = window.location.href; var formurl = this.href; if (formurl != cururl) { e.preventDefault(); $.ajax({ type: 'GET', url: formurl, success: function(html) { var h = $(html).find(".email-form").html(); var dlg = new framework.Dialog({ body: h, title: $(html).find(".email-form").data('title'), width: '495px', height: '568px', caller: e.target }); dlg.onOpen(function() { $('.modal-body .form-container .field-group-vertical').first().find('input').focus(); $('.modal-body .form-container .field-group-vertical').first().find('input').on('keydown', function(e){ if(e.which === 9 && e.shiftKey) { e.preventDefault(); $('button.modal-header-close').focus(); } }); $('button.modal-header-close').on('keydown', function(e){ if(e.which === 9 && !e.shiftKey) { e.preventDefault(); $('.modal-body .form-container .field-group-vertical').first().find('input').focus(); } }); }); dlg.open(); }, error: function(req,text,error) { console.info("Error ",error); }, dataType: 'html', data: null }); } }); /*Consider putting this in a separate js file?*/ (function ($) { $.fn.conditionize = function(options) { var settings = $.extend({ hideJS: true }, options ); $.fn.eval = function(valueIs, valueShould, operator) { switch(operator) { case '==': return valueIs == valueShould; break; case '!=': return valueIs != valueShould; case '=': return valueIs >= valueShould; case '>': return valueIs > valueShould; } } $.fn.showOrHide = function(listenTo, listenFor, operator, $section) { if ($(listenTo).is('select, input[type=text]') && $.fn.eval($(listenTo).val(), listenFor, operator)) { $section.slideDown(); } else if ($(listenTo + ":checked").filter(function(idx, elem){return $.fn.eval(elem.value, listenFor, operator);}).length > 0) { $section.slideDown(); } else { $section.slideUp(); } } return this.each( function() { var listenTo = "[name=" + $(this).data('cond-option').replace( /(:|\.|\[|\]|,)/g, "\\$1" ) + "]"; var listenFor = $(this).data('cond-value'); var operator = $(this).data('cond-operator') ? $(this).data('cond-operator') : '=='; var $section = $(this); //Set up event listener $(listenTo).on('change', function() { $.fn.showOrHide(listenTo, listenFor, operator, $section); }); //If setting was chosen, hide everything first... if (settings.hideJS) { $(this).hide(); } //Show based on current value on page load $.fn.showOrHide(listenTo, listenFor, operator, $section); }); } }(jQuery)); // (function ($) $('.conditional').conditionize(); jQuery(function($){ // When there is a video header should play video $('.publications .video-title').click(function(e){ var title = (this); var video = $(title).closest('.publication').find('a[class^="widget-video-"]:visible'); if(video.length groups[g]) { groups[g] = h; } }) // equal set the min-height $(".equal-heights-item").each(function(){ var g = $(this).data('equal-heights-group'); if (g == undefined) { g = $(this).data('equal-heights-group-js'); } var h = groups[g]; $(this).css('min-height',h); }) } $( window ).on( 'load facetctrl.update.complete', function() { recalc(); //If we are using the equal heights on the search page trigger a redraw if (typeof iso != "undefined") { console.log('if search page rearrange tiles'); iso.layout(); } }) $(document).on('framework.resize' ,function(){ recalc(); }) }); jQuery(function($){ $(".stats").one('framework.in-viewport',function(){ $(".stat .item",this).each(function(i,el){ window.setTimeout(function(){ window.requestAnimationFrame(function(){ $(el).addClass('fade-in'); //console.log(el); }) },i*400) }) }) // just run the animation for touch devices $(".ua-touch .stats").trigger('framework.in-viewport'); }) jQuery(function($){ });