7-homepage-rows edit

homepage-hero  edit

W&M menu close William & Mary

Ambient video of scenes of life at William & Mary: aerial view of the historic Wren Building; a student and faculty member working in front of whiteboards; a student on a research boat; two people working in a lab; students tossing colorful powder during a Holi celebration on campus; students on an inflatable ride; W&M cheerleaders and griffin mascot celebrating at a football game in Zable Stadium

Copy
Edit
<!-- components/7-homepage-rows/homepage-hero.php --> <link rel="stylesheet" type="text/css" href="/atomic-docs/wm/prod/main.css"> <section class="HomeHero"> <?php outputMenu("topbar"); ?> <header id="main-header"> <?php outputMenu("site-menu"); ?> <?php outputMenu("info-for-menu"); ?> </header> <!-- <div class="logo-wrapper"> <img alt="William &amp; Mary home" src="http://localhost/wmhome24/files/wm_full_horizontal.svg"> </div> --> <div class="HomeHero__wrapper aos-init aos-animate" data-aos="fade" data-aos-delay="0" data-aos-duration="400"> <div class="HomeHero__video-wrapper videocontainer"> <p class="sr-only HomeHero__video-description" id="video_description">Ambient video of scenes of life at William &amp; Mary: aerial view of the historic Wren Building; a student and faculty member working in front of whiteboards; a student on a research boat; two people working in a lab; students tossing colorful powder during a Holi celebration on campus; students on an inflatable ride; W&amp;M cheerleaders and griffin mascot celebrating at a football game in Zable Stadium</p> <video aria-describedby="video_description" autoplay="autoplay" id="hero_video" loop="loop" muted="" playsinline="" poster="" preload="auto" tabindex="-1" src=""></video> <!-- image stand in for video while developing --> <!-- <img class="HomeHero__video-image" alt="Aerial view of the historic Wren Building" src="http://localhost/atomic-docs/wm/images/aerial.jpg"> --> <button class="HomeHero__video-button" id="video_button"><i aria-hidden="true" class="fa fa-pause"></i><span class="sr-only">Pause video</span></button> </div> <div class="HomeHero__caption-wrapper"> <h2 class="HomeHero__caption-title"></h2> <p class="HomeHero__caption-text"></p> <div class="HomeHero__links-wrapper hidden"> <a class="HomeHero__links-link HomeHero__links-primarylink" href="https://www.wm.edu/about/index.php" target="_parent" aria-label="More about William &amp; Mary"></a> <a class="HomeHero__links-link hidden" href="https://www.wm.edu/about/index.php" target="_parent" aria-label="More about William &amp; Mary"></a> </div> </div> </div> </section> <script> // fix Adjust Hero height if there is a broadcast message var broadcast = document.querySelector('.broadcastBarTop'); if (broadcast) { var myHero = document.querySelector('.m-hero'); if (myHero) { myHero.classList.add('is-broadcast'); } } var myWMHero = { "items": [{ "address": "https://creative.wm.edu/media/WebShort1.mp4", alt: "Ambient video of scenes of life at William &amp; Mary: aerial view of the historic Wren Building; a student and faculty member working in front of whiteboards; a student on a research boat; two people working in a lab; students tossing colorful powder during a Holi celebration on campus; students on an inflatable ride; W&amp;M cheerleaders and griffin mascot celebrating at a football game in Zable Stadium", captiontitle: "Distinct <i>&</i> Distinguished", captiontext: "Located in Williamsburg, Virginia, William &amp; Mary brings together the global opportunities of a larger research university with the personal education of a liberal arts and sciences institution.", linkarialabel: "More about William &amp; Mary", links: [{ "text": "More 1", "url": "/1/index.php" }, { "text": "More 2", "url": "/2/index.php" } ] }, { "address": "https://creative.wm.edu/media/WebShort2.mp4", alt: "Ambient video of scenes of life at William &amp; Mary: a student walking an historic brick pathway on campus; a faculty member and student discussing art in a gallery; Bhangra dancers perform outside of Zable Stadium; students giving a presentation in a glass-walled classroom; opening ceremony at an athletic event with military uniformed participants; students smiling and waving with their painted sign; the Crim Dell bridge framed by golden fall foliage", captiontitle: "2Gathering the brightest minds for a better world.", captiontext: "William &amp; Mary is a premier public research university, widely recognized for our outstanding academic reputation, beautiful campus and vibrant community. We produce experienced, engaged and successful graduates who lead lives of impact.", linkarialabel: "More about William &amp; Mary", links: [{ "text": "More 5", "url": "/5/index.php" }] }, { "address": "https://creative.wm.edu/media/WebShort3.mp4", alt: "Ambient video of scenes of life at William &amp; Mary: aerial view of the Sadler Center student union and Wellness Center buildings; students hiking in nature; students and a faculty member working in a lab; students cheering in Zable Stadium as the football team takes the field; a student fabricating metal in an industrial studio; students cheering on campus; aerial view of the Sunken Garden with students relaxing together at sunset", captiontitle: "3Gathering the brightest minds.", captiontext: "William &amp; Mary is a premier public research university, widely recognized for our outstanding academic reputation, beautiful campus and vibrant community. We produce experienced, engaged and successful graduates who lead lives of impact.", linkarialabel: "More about William &amp; Mary", links: [] }, ] } // ---------------------- HERO ROW: VIDEO OR IMAGE ------------------ // if (typeof myWMHero !== 'undefined') { if (typeof randomIndex == 'undefined') { var randomIndex = Math.floor(Math.random() * myWMHero.items.length); } var randomAddress = myWMHero.items[randomIndex].address; var randomAlt = myWMHero.items[randomIndex].alt; var randomExtension = randomAddress.split('.').pop(); var randomCaptionTitle = myWMHero.items[randomIndex].captiontitle; var randomCaptionText = myWMHero.items[randomIndex].captiontext; var randomLinkAriaLabel = myWMHero.items[randomIndex].linkarialabel; var randomLinkAriaLabel = randomLinkAriaLabel.replace(/&amp;/g, '&'); var randomPrimaryLink = myWMHero.items[randomIndex].links[0]; if (typeof randomPrimaryLink !== 'undefined') { var randomPrimaryLinkText = randomPrimaryLink.text.replace(/&amp;/g, '&'); } var randomSecondaryLink = myWMHero.items[randomIndex].links[1]; if (typeof randomSecondaryLink !== 'undefined') { var randomSecondaryLinkText = randomSecondaryLink.text.replace(/&amp;/g, '&'); } if (randomExtension == "mp4") { // do video things myItem = document.querySelector(".HomeHero__wrapper"); myItemInner = myItem.querySelector(".videocontainer"); myVideo = myItemInner.querySelector("video"); // wait for video to load, then fade in myVideo.addEventListener('loadedmetadata', function(event) { myItemInner.classList.add("heroin"); myItemInner.classList.remove("hidden"); myItem.classList.remove("hidden"); }); myVideo.setAttribute("src", randomAddress); myVideo.load(); myDescription = document.querySelector("#video_description"); myDescription.innerHTML = randomAlt; } else { // do image things myItemInner = document.querySelector("HomeHero__video-image"); // myItemInner = myItem.querySelector("span"); // preload the image into browser cache var my_image = new Image(); my_image.onload = function() { myItemInner.style.backgroundImage = "url('" + randomAddress + "')"; myItemInner.setAttribute("aria-label", randomAlt); myItemInner.classList.add("heroin"); myItemInner.classList.remove("hidden"); myItem.classList.remove("hidden"); }; my_image.src = randomAddress; } // do caption things if (randomCaptionTitle !== "") { myCaptionTitle = document.querySelector(".HomeHero__caption-title"); myCaptionTitle.innerHTML = randomCaptionTitle; } if (randomCaptionText !== "") { myCaptionText = document.querySelector(".HomeHero__caption-text"); myCaptionText.innerHTML = randomCaptionText; } if (randomPrimaryLink !== undefined) { linkContainer = document.querySelector(".HomeHero__links-wrapper"); linkContainer.classList.remove("hidden"); let myPrimaryLink = linkContainer.querySelector("a:first-child"); myPrimaryLink.setAttribute("href", randomPrimaryLink.url); if (randomLinkAriaLabel !== "") { myPrimaryLink.setAttribute("aria-label", randomLinkAriaLabel); } myPrimaryLink.innerHTML = randomPrimaryLinkText; if (typeof randomSecondaryLink !== 'undefined') { let mySecondaryLink = linkContainer.querySelector("a:last-child"); mySecondaryLink.classList.remove("hidden"); mySecondaryLink.setAttribute("href", randomSecondaryLink.url); if (randomLinkAriaLabel !== "") { mySecondaryLink.setAttribute("aria-label", randomLinkAriaLabel); } mySecondaryLink.innerHTML = randomSecondaryLinkText; } } else { linkContainer = document.querySelector(".HomeHero__links-wrapper"); linkContainer.setAttribute("hidden", "hidden"); } } // ---------------------- VIDEOS PLAY/PAUSE ------------------ // /* HERO */ var ppbutton = document.getElementById("video_button"); if (ppbutton) { ppbutton.addEventListener("click", playPauseHero); } var myHeroVideo = document.getElementById("hero_video"); myHeroVideo.pause(); function playPauseHero() { if (myHeroVideo) { if (myHeroVideo.paused) { myHeroVideo.play(); ppbutton.innerHTML = '<i aria-hidden="true" class="fa fa-pause"></i><span class="sr-only">Pause video</span>'; } else { myHeroVideo.pause(); ppbutton.innerHTML = '<i aria-hidden="true" class="fa fa-play"></i><span class="sr-only">Play video</span>'; } } } /* Prefers Reduced Motion */ var motionQuery = window.matchMedia('screen and (prefers-reduced-motion: reduce)'); function handleReduceMotionChanged() { if (motionQuery.matches) { if (myHeroVideo) { myHeroVideo.pause(); ppbutton.innerHTML = '<i aria-hidden="true" class="fa fa-play"></i><span class="sr-only">Play video</span>'; } if (myEventsVideo) { myEventsVideo.pause(); eppbutton.innerHTML = '<i aria-hidden="true" class="fa fa-play"></i><span class="sr-only">Play video</span>'; } } }; handleReduceMotionChanged(); // trigger this once on load to set up the initial value motionQuery.addListener(handleReduceMotionChanged); // Note: https://webkit.org/b/168491 </script> <!-- <script src="<?php echo $base_url; ?>/js/homepage-hero.js" type="text/javascript"> -->
Copy
Copy
Edit
/* scss/7-homepage-rows/_homepage-hero.scss */ $homehero-tablet-breakpoint: 830px; $homehero-topbar-desktop-breakpoint: 830px; $xxs: 6px; $xs: 11px; $sm: 22px; $md: 44px; $lg: 66px; $xl: 88px; $xxl: 100px; :root { --serif-font: "Noto Serif"; --sans-font: "Nunito Sans"; --spacing-xxs: #{$xxs}; --spacing-xs: #{$xs}; --spacing-sm: #{$sm}; --spacing-md: #{$md}; --spacing-lg: #{$lg}; --spacing-xl: #{$xl}; --spacing-xxl: #{$xxl}; --wmgold-600: var(--color-wmgold-55, #b9975b); --wmgold-800: #6f5b37; --webgold: var(--color-webgold-75, #866f45); --webgold-600: #b9975b; --wmsilver-100: #fafbfb; --wmsilver-300: #ecedee; --wmsilver-600: var(--color-wmsilver-25, #d0d3d4); --wmgreen-200: #cfddd9; --wmgreen-300: #a0bcb3; --wmgreen-400: #709a8c; --wmgreen-600: var(--color-wmgreen-90, #115740); --text-body: var(--color-wmsilver-100, #282626); --moss-600: #789d4a; --moss-700: #607e3b; --patina-600: #00b388; --patina-700: #008f6d; --weatheredbrick-600: #e56a54; --weatheredbrick-700: #b75543; } // ================== HERO ROW ================== // .HomeHero { --max-caption-width: 644px; box-sizing: border-box; width: 100%; height: 100%; position: relative; transition: all 0.15s; border-bottom: 6px solid var(--wmgold-600); @include breakpoint(#{$homehero-tablet-breakpoint}) { border-bottom: none; } // -------- Topbar - mobile -------- // .wm-topbar { border-top: none; height: 55px; &__menu-button { height: 55px; background-color: var(--webgold); } &__logo-homepage, &__logo-homepage-links { display: none; } } // -------- Topbar - desktop -------- // @include breakpoint($homehero-topbar-desktop-breakpoint) { #main-header { margin-top: 0 !important; } .wm-topbar { position: absolute; top: 0; left: 0; width: 100%; background-color: transparent; box-shadow: none; .wm-topbar__logo { // 105px accounts for padding on logo on wide desktop flex-basis: calc(1288px + 105px); flex-grow: 0; flex-shrink: 1; } &__logo-link { display: none; } & .button-wrapper-for-older-browsers { position: sticky; } &__buttons { overflow: hidden; height: 8rem; } &__menu-button { display: flex; width: 8.3125rem; height: 80px !important; top: 0 !important; // height: 4.5rem; } &__menu-button-text { padding-bottom: 10px !important; padding-top: 0 !important; font-family: var(--sans-font) !important; font-size: 10px !important; font-style: normal !important; font-weight: 600 !important; line-height: normal !important; letter-spacing: 1px !important; } // changed these styles so the height would be correct &__info-for-button { display: block; top: 91px !important; padding-left: 0 !important; overflow: visible !important; transition: all 0.15s !important; &:hover { width: 134px !important; } .fa-xmark { top: 9.5px !important; left: 18px !important; transition: all 0.15s !important; } span:hover { left: 0px !important; } &:hover .fa-xmark, &:hover span { left: 8px !important; } } &__info-for-button::before, &__info-for-button:hover:before { top: 0px; right: -15px; background-color: var(--wmgreen-600); transition: all 0.15s; width: 145px; } &__info-for-button:hover:before { right: -5px; } &__info-for-button span { top: 8px !important; left: 18px !important; height: 35px !important; transition: all 0.15s; background-color: transparent !important; font-family: var(--sans-font); font-size: 11px; font-style: italic; font-weight: 600; line-height: 1.81818; letter-spacing: 0.11px; &:hover { left: 8px !important; } } &__logo-homepage { width: 100%; margin-top: 33px; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; &-logo { flex: 1 1 370px; } &-img { height: 27px; margin: 0 var(--spacing-md) 0 var(--spacing-md); } &-links { display: flex; height: 15px; flex: 1 1 max(var(--spacing-md)); width: clamp(33px, 26vw, 277px); justify-content: space-between; align-items: center; position: absolute; top: 41px; right: 133px; // sets spacing between text and wm menu button &::after { content: ""; display: block; width: 1px; height: 15px; background-color: transparent; } } &-link { color: var(--color-wmsilver-25); font-family: var(--sans-font); font-size: 1rem; font-style: normal; font-weight: 500; line-height: 1.25; letter-spacing: 0.8px; &:hover { color: white; text-decoration-line: underline; } } } } } &__wrapper { @include breakpoint(#{$homehero-tablet-breakpoint}) { position: relative; } } // --------- Hero row large media --------- // &__video-wrapper { aspect-ratio: 3 / 2; position: relative; width: 100%; background-color: black; background-position: center; background-size: cover; video { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: -4px; // this accounts for some extra space at the bottom @include breakpoint(#{$homehero-tablet-breakpoint}) { margin-bottom: 0; } } @include breakpoint(#{$homehero-tablet-breakpoint}) { position: relative; border-bottom: 6px solid var(--wmgold-600); &::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 390px; background: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0) 100%); } &::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 207px; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000 100%); } } } &__video-button { all: unset; position: absolute; bottom: var(--spacing-sm); right: var(--spacing-sm); z-index: 1; height: 30px; width: 30px; display: flex; justify-content: center; align-items: center; border-radius: 4px; background: rgba(217, 220, 221, 0.1); color: white; font-family: "Font Awesome 6 Pro"; font-size: 14px; font-style: normal; font-weight: 400; line-height: normal; letter-spacing: 0.5px; &:hover { background: rgba(217, 220, 221, 0.2); cursor: pointer; } @include breakpoint(#{$homehero-tablet-breakpoint}) { right: var(--spacing-md); bottom: var(--spacing-lg); } @include breakpoint(1376px) { right: calc((100% - 1288px) / 2); } } // --------- Hero row caption --------- // &__caption-wrapper { width: 100%; text-align: center; background-color: var(--color-griffingreen-100); @include breakpoint(#{$homehero-tablet-breakpoint}) { position: absolute; bottom: 0; left: 0; right: 0; width: 100%; max-width: calc(1288px + (var(--spacing-md) + var(--spacing-md))); padding: 0 var(--spacing-md) var(--spacing-lg) var(--spacing-md); margin: 0 auto; background-color: transparent; text-align: left; } } &__caption-title { padding: 10px var(--spacing-sm) 14px; margin: 0; background-color: var(--color-wmgreen-90); color: white; font-family: var(--serif-font); font-size: 38px; font-style: normal; font-weight: 400; line-height: 1.31; @include breakpoint(#{$homehero-tablet-breakpoint}) { width: fit-content; max-width: var(--max-caption-width); border-radius: 4px 4px 0px 0px; } } &__caption-text { padding: var(--spacing-sm); border-radius: 0px 4px 4px 4px; margin: 0; color: rgba(255, 255, 255, 0.8); border-radius: 0px 4px 4px 4px; font-family: var(--sans-font); font-size: 14px; font-style: normal; font-weight: 400; line-height: 1.71429; letter-spacing: 0.28px; @include breakpoint(#{$homehero-tablet-breakpoint}) { max-width: var(--max-caption-width); background-color: var(--color-griffingreen-100); } } // --------- Hero row links --------- // &__links-wrapper { padding: var(--spacing-sm); padding-top: 0; @include breakpoint(500px) { display: flex; justify-content: center; gap: var(--spacing-xs); } @include breakpoint(#{$homehero-tablet-breakpoint}) { justify-content: flex-start; padding: 0; margin-top: 33px; } } &__links-link { display: block; padding: 18px var(--spacing-md); color: white; border-radius: 4px; text-align: center; font-family: var(--sans-font); font-size: 16px; font-style: normal; font-weight: 600; line-height: 1.25; border-radius: 4px; &:hover { background: rgba(240, 241, 242, 0.15); text-decoration: none; } } &__links-primarylink { background-color: var(--webgold); &:hover { background: var(--wmgold-800); } } .hidden { display: none; } }
Copy
Edit

Warning: file_get_contents(../js/homepage-hero.js): failed to open stream: No such file or directory in /www/virtualhosts/htdocs/creative.wm.edu/public_html/atomic-docs/wm/atomic-core/index.php on line 420