Commit cac1a80a authored by minseok.park's avatar minseok.park

mobile에서 download 안되는 문제 수정 및 mobile-nav ui 수정

parent 1e567166
Pipeline #21692 passed with stages
in 4 minutes
......@@ -7,7 +7,6 @@
const MobileMenuToggle = document.querySelector('.nav-mobile-menu-toggle')
const documentToggle = document.getElementById('document-toggle')
const documentIcon = document.getElementById('document-icon')
const menuIconDefault = `
<svg stroke="currentColor" fill="#0072ce" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
<path fill="none" d="M0 0h24v24H0z"></path>
......@@ -21,6 +20,23 @@
</svg>
`
// 화면 크기 감지하여 모바일 화면이 아닐 때 show 클래스 제거
function checkWindowSize () {
const menuList = document.querySelector('.navbar-mobile-menu')
if (window.matchMedia('(min-width: 1023.5px)').matches) {
menuList.classList.remove('show') // 모바일 화면이 아닐 때 show 제거
MobileMenuToggle.innerHTML = menuIconDefault // 아이콘 초기화
isMenuOpen = false
}
}
// 페이지 로드 시 화면 크기 체크
window.addEventListener('load', checkWindowSize)
// 화면 크기가 변경될 때마다 체크
window.addEventListener('resize', checkWindowSize)
// 메뉴 토글 기능
MobileMenuToggle.addEventListener('click', function () {
isMenuOpen = !isMenuOpen
......
......@@ -2,6 +2,7 @@
'use strict'
var download = document.getElementById('download')
const downlaodMobile = document.getElementById('mobile-download')
document.addEventListener('scroll', function () {
var navbar = document.querySelector('.navbar')
......@@ -29,4 +30,21 @@
document.body.removeChild(link)
}
})
downlaodMobile.addEventListener('click', function () {
var pathname = window.location.pathname
var path = pathname.split('/')
var isInternal = path[4].includes('-s')
var filename = path[3] ? path[3] === 'swlab-docs'
? 'docs' : isInternal ? `docs-${path[3]}-s` : `docs-${path[3]}` : ''
var directory = path[3] && path[4] ? path[3] === 'swlab-docs' ? path[3] : path[4] : ''
var link = document.createElement('a')
link.href = `https://swlab.bwg.co.kr/web/dms/download-file?filename=${filename}.zip&directory=${directory}`
link.click()
if (link.parentNode) {
document.body.removeChild(link)
}
})
})()
......@@ -64,7 +64,7 @@
<li class="product-link secret-nav" onclick="window.location.href='https://swlab.bwg.co.kr/web/docs/swlab-docs/current/ready-to-write/text-editor.html'">Manual Guide</li>
</ul>
<li class="mobile-menu-item">
<a id="download" class="button download" href="#">
<a id="mobile-download" class="button download" href="#">
<i class="download_icon"></i>
Download
</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment