| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <%@ page pageEncoding="UTF-8"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <script src="/main/dist/websites/plug-in/jquery/jquery1.11.3.min.js"></script>
- <c:set var="educationSiteTitle" value="${empty website.seoTitle ? website.name : website.seoTitle}"/>
- <c:set var="educationLogo" value="${empty website.logo ? '/main/ffkj-portal/education/education-logo.png' : website.logo}"/>
- <header class="edu-topbar" id="top">
- <div class="edu-wrap edu-topbar-inner">
- <a class="edu-brand" href="/" aria-label="${educationSiteTitle}首页">
- <img class="edu-brand-logo" src="${educationLogo}" alt="${educationSiteTitle}">
- </a>
- <div class="edu-top-tools">
- <nav class="edu-top-links" aria-label="快捷入口">
- <c:set var="educationSchoolHomeFound" value="${false}" scope="request"/>
- <c:forEach items="${educationTopLinksNmv.articleList}" var="item">
- <c:if test="${item.title eq '学校首页'}"><c:set var="educationSchoolHomeFound" value="${true}" scope="request"/></c:if>
- <a href="${item.url}" target="${item.target}" rel="noopener">${item.title}</a>
- </c:forEach>
- <c:if test="${not educationSchoolHomeFound}">
- <a href="${empty educationSchoolHomeUrl ? 'https://www.gzhxtc.edu.cn/' : educationSchoolHomeUrl}">${empty educationSchoolHomeName ? '学校首页' : educationSchoolHomeName}</a>
- </c:if>
- <c:if test="${empty educationTopLinksNmv.articleList}"><a href="/">本站首页</a></c:if>
- </nav>
- <form class="edu-top-search" action="/search" method="get" role="search">
- <label class="edu-sr-only" for="edu-top-search-input">搜索本站内容</label>
- <input id="edu-top-search-input" name="str" type="search" value="${str}" placeholder="搜索文章、通知、专业…" autocomplete="off">
- <button type="submit" aria-label="搜索">
- <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="10.7" cy="10.7" r="6.5"></circle><path d="m15.5 15.5 5 5"></path></svg>
- </button>
- </form>
- <button class="edu-nav-toggle" type="button" aria-label="打开导航" aria-expanded="false" aria-controls="education-main-nav"><span></span><span></span><span></span></button>
- </div>
- </div>
- </header>
- <nav class="edu-nav" id="education-main-nav" aria-label="${educationSiteTitle}主导航">
- <div class="edu-wrap edu-nav-inner">
- <div class="edu-nav-item">
- <a class="edu-nav-link ${empty navigation ? 'is-active' : ''}" href="/">首页</a>
- </div>
- <c:forEach items="${navList}" var="item">
- <c:if test="${item.name ne '首页' and item.name ne '首页子栏目'}">
- <div class="edu-nav-item ${not empty item.children ? 'has-children' : ''}">
- <c:set var="educationNavHref" value="${item.href}"/>
- <c:if test="${not empty item.children}"><c:set var="educationNavHref" value="${empty item.children[0].href ? item.href : item.children[0].href}"/></c:if>
- <div class="edu-nav-row">
- <a class="edu-nav-link ${item.navigationid eq navigation.navigationid or item.navigationid eq navigation.parentNid ? 'is-active' : ''}" href="${educationNavHref}" target="${item.target}" rel="noopener">${item.name}</a>
- <c:if test="${not empty item.children}"><button class="edu-subnav-toggle" type="button" aria-label="展开${item.name}子栏目" aria-expanded="false" aria-controls="education-subnav-${item.navigationid}"></button></c:if>
- </div>
- <c:if test="${not empty item.children}">
- <div class="edu-subnav" id="education-subnav-${item.navigationid}">
- <c:forEach items="${item.children}" var="child"><a href="${child.href}" target="${child.target}" rel="noopener">${child.name}</a></c:forEach>
- </div>
- </c:if>
- </div>
- </c:if>
- </c:forEach>
- </div>
- </nav>
- <div class="edu-menu-mask" aria-hidden="true"></div>
- <script>
- (function () {
- var toggle = document.querySelector('.edu-nav-toggle');
- var nav = document.querySelector('.edu-nav');
- var mask = document.querySelector('.edu-menu-mask');
- if (!toggle || !nav || !mask) return;
- var mobileBreakpoint = 1120;
- var backgroundNodes = [
- document.querySelector('.edu-brand'),
- document.querySelector('.edu-top-links'),
- document.querySelector('.edu-top-search'),
- document.querySelector('main'),
- document.querySelector('.edu-footer'),
- document.querySelector('.edu-back-top')
- ].filter(Boolean);
- function setBackgroundInert(inert) {
- backgroundNodes.forEach(function (node) { node.inert = inert; });
- }
- function syncState() {
- var mobile = window.innerWidth <= mobileBreakpoint;
- if (!mobile) {
- nav.classList.remove('is-open');
- mask.classList.remove('is-open');
- toggle.classList.remove('is-open');
- toggle.setAttribute('aria-expanded', 'false');
- toggle.setAttribute('aria-label', '打开导航');
- document.documentElement.style.overflow = '';
- Array.prototype.forEach.call(nav.querySelectorAll('.edu-nav-item.has-children.is-open'), function (item) {
- item.classList.remove('is-open');
- var itemLink = item.querySelector('.edu-nav-link');
- if (itemLink) itemLink.setAttribute('aria-expanded', 'false');
- });
- }
- var offscreen = mobile && !nav.classList.contains('is-open');
- nav.inert = offscreen;
- if (mobile) nav.setAttribute('aria-hidden', offscreen ? 'true' : 'false');
- else nav.removeAttribute('aria-hidden');
- setBackgroundInert(mobile && nav.classList.contains('is-open'));
- }
- function setOpen(open) {
- nav.classList.toggle('is-open', open);
- mask.classList.toggle('is-open', open);
- toggle.classList.toggle('is-open', open);
- toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
- toggle.setAttribute('aria-label', open ? '关闭导航' : '打开导航');
- document.documentElement.style.overflow = open ? 'hidden' : '';
- setBackgroundInert(open && window.innerWidth <= mobileBreakpoint);
- syncState();
- }
- toggle.addEventListener('click', function () { setOpen(!nav.classList.contains('is-open')); });
- mask.addEventListener('click', function () { setOpen(false); });
- Array.prototype.forEach.call(nav.querySelectorAll('.edu-subnav-toggle'), function (button) {
- button.addEventListener('click', function (event) {
- event.preventDefault();
- var item = button.closest('.edu-nav-item');
- if (!item) return;
- var open = !item.classList.contains('is-open');
- Array.prototype.forEach.call(nav.querySelectorAll('.edu-nav-item.has-children.is-open'), function (otherItem) {
- otherItem.classList.remove('is-open');
- var otherButton = otherItem.querySelector('.edu-subnav-toggle');
- if (otherButton) otherButton.setAttribute('aria-expanded', 'false');
- });
- item.classList.toggle('is-open', open);
- button.setAttribute('aria-expanded', open ? 'true' : 'false');
- });
- });
- Array.prototype.forEach.call(nav.querySelectorAll('.edu-subnav a'), function (link) {
- link.addEventListener('click', function () { if (window.innerWidth <= mobileBreakpoint) setOpen(false); });
- });
- document.addEventListener('keydown', function (event) { if (event.key === 'Escape') setOpen(false); });
- window.addEventListener('resize', syncState);
- syncState();
- })();
- </script>
|