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 }) }) jQuery(function($){ // Video module headline should play video $('.big-feature .video-title').click(function(e){ var title = (this); var video = $(title).closest('.big-feature').find('.left-column').find('a.widget-video-inline'); console.log(title); console.log(video); $(video).click(); }); }); 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(); }) }); jQuery(function($){ function recalc(){ var groups = {}; $(".equal-heights-item").each(function(){ var g = $(this).data('equal-heights-group'); if (g == undefined) { g = $(this).offset().top; $(this).data('equal-heights-group-js',g); } $(this).css('min-height','auto'); var h = $(this).outerHeight() + 1; groups[g] = groups[g] || 0; if (h > 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($){ // Video module headline should play video in desktop $('.news-feature .video-titleD').click(function(e){ e.preventDefault(); var title = (this); var videoD = $(title).closest('.feature-wrapper').find('.widget-video-inline'); console.log(title); console.log(videoD); $(videoD).click(); }); // Video module headline should play video in mobile $('.news-feature .video-title').click(function(e){ e.preventDefault(); var title = (this); var video = $(title).closest('.feature-wrapper').find('.widget-video-wrapper').find('button'); console.log(title); console.log(video); $(video).click(); }); }); jQuery(function($){ console.info('domready'); $(".card-feature .card a.play-mobile-video").click(function(event){ event.preventDefault(); $(this).parents('.card').find('.video-container .mobile-visible .kWidgetPlayBtn').click(); }); }); require(['https://d1gfwsbop52idw.cloudfront.net/static/libs/smartquotes/2.3.1/smartquotes.min.js'],function(smartquotes){ $(".text-feature").each(function(){ smartquotes(this); }) })