<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="layouts/layout">
<style>
.editors-wrapper{
display: flex;
flex-direction: row;
position: absolute;
top:0px;
height: 100%;
width: 100%;
padding-top: 1.813rem;
z-index: 1;
}
.doc, .xls{
height: 100%;
width: 100%;
position: relative;
}
#between-doc-xls{
cursor: pointer;
background-color: #f1f1f1;
display: flex;
flex-direction: row;
align-items: center;
justify-self: center;
}
</style>
<div layout:fragment="content">
<div class="editors-wrapper" id="editors-wrapper">
<div class="doc" id="doc-wrapper">
<div id="doc-placeholder" style="height:100%;"></div>
</div>
<div id="between-doc-xls">
<span class="badge bg-secondary btn">
<i class="fas fa-caret-left"></i>
<i class="fas fa-caret-right"></i>
</span>
</div>
<div class="xls" id="xls-wrapper">
<div id="xls-placeholder" style="height: 100%;"></div>
</div>
</div>
<script th:inline="javascript">
var startpos, diffpos = 0;
var range = 50;
var isEnable = false;
function onMouseDown(e){
startpos = event.clientX + diffpos;
isEnable=true;
return false;
}
function onMouseUp(e){
isEnable=false;
return false;
}
function onMouseMove(e){
if(isEnable){
pos = event.clientX;
diffpos = startpos-pos;
var w = window.innerWidth/2;
if(diffpos > -(w-range) && diffpos < (w-range)){
$('#doc-wrapper').width(w-diffpos);
$('#xls-wrapper').width(w-20+diffpos);
}
}
}
document.getElementById("between-doc-xls").onmousedown = onMouseDown;
document.onmouseup = onMouseUp;
document.onmousemove = onMouseMove;
</script>
</div>
</html>
References
'프로그래밍 언어 > Javascript' 카테고리의 다른 글
Javascript) 서버에서 보내는 Blob 객체 > File 객체 받기 (0) | 2021.11.12 |
---|---|
Javascript) 디렉토리 선택하여 파일 리스트 가져오기 (0) | 2021.11.11 |
Javascript) 자식 요소 모두 제거하기 (0) | 2021.08.13 |
Javascript/Jquery) jquery 선택자에서 변수 사용하기 (0) | 2021.06.18 |
Javascript/jquery) LocalStorage를 활용해서 input에 입력한 값 새로고침해도 유지하기 (0) | 2021.06.18 |