当前位置:网站首页>Live broadcast platform development, flexible menu, and freely adjust the horizontal size of the menu bar
Live broadcast platform development, flexible menu, and freely adjust the horizontal size of the menu bar
2022-07-02 08:14:00 【Cloudleopard network technology】
Live platform development , Retractable menu , Randomly adjust the size of the menu bar horizontally to achieve the relevant code
/* Drag area div style */
.resize {
cursor: col-resize;
position: relative;
// top: 45%;
top: 400px;
background-color: #d6d6d6;
border-radius: 5px;
margin-top: -10px;
width: 10px;
height: 50px;
background-size: cover;
background-position: center;
font-size: 32px;
color: white;
}
/* Drag and drop area mouse over style */
.resize:hover {
color: #444444;
}
// The left menu sets the percentage width , Easy drag and drop adaptive .main_menu {
width:22%; /* Right initialization width */
height: 100%;
background: #BF334E!important;
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.11);
}
methods Drag and drop function inside :
// Drag events dragControllerDiv() {
var resize = document.getElementsByClassName('resize')
var left = document.getElementsByClassName('left')
var mid = document.getElementsByClassName('mid')
var box = document.getElementsByClassName('box')
for (let i = 0; i < resize.length; i++) {
// Mouse down event resize[i].onmousedown = function (e) {
// Color change reminder resize[i].style.background = '#818181' var startX = e.clientX resize[i].left = resize[i].offsetLeft // Mouse drag events document.onmousemove = function (e) {
console.log(' The mouse click ')
var endX = e.clientX
var moveLen = resize[i].left + (endX - startX - 270) // (endx-startx)= Distance traveled .resize[i].left+ Distance traveled = The last width of the left area
var maxT = box[i].clientWidth - resize[i].offsetWidth - 270// Container width - The width of the left area = The width of the right area
console.log(moveLen,maxT)
if (moveLen < 32) moveLen = 270 // The minimum width of the left area is 32px
if (moveLen > maxT - 150) moveLen = maxT - 650 // The minimum width of the right area is 150px
resize[i].style.left = moveLen // Set the width of the left area
for (let j = 0; j < left.length; j++) {
console.log( left[j].style)
left[j].style.width = moveLen + 'px'
mid[j].style.width = box[i].clientWidth - moveLen - 10 + 'px'
}
}
// Mouse Up Event document.onmouseup = function (evt) {
console.log(' Mouse up ')
// Color recovery
resize[i].style.background = '#d6d6d6'
document.onmousemove = null
document.onmouseup = null
resize[i].releaseCapture && resize[i].releaseCapture() // When you no longer need to continue to get mouse messages, you should call ReleaseCapture() release
}
resize[i].setCapture && resize[i].setCapture() // This function sets the mouse capture in the specified window belonging to the current thread
return false
}
}
},
mounted It calls :
mounted() {
this.dragControllerDiv()
},
suoh's Blog
The above is the development of live broadcasting platform , Retractable menu , Randomly adjust the size of the menu bar horizontally to achieve the relevant code , More content welcome to follow the article
边栏推荐
- 应对长尾分布的目标检测 -- Balanced Group Softmax
- Causes of laptop jam
- Using super ball embedding to enhance confrontation training
- Command line is too long
- Use of opencv3 6.2 low pass filter
- Li Kou daily one question brushing summary: binary tree chapter (continuous update)
- OpenCV 6.4 中值滤波器的使用
- Programmers can only be 35? The 74 year old programmer in the United States has been programming for 57 years and has not retired
- I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
- Wang extracurricular words
猜你喜欢
The internal network of the server can be accessed, but the external network cannot be accessed
[learning notes] numerical differentiation of back error propagation
How to back up the configuration before the idea when reinstalling the idea
利用超球嵌入来增强对抗训练
MySQL优化
浅谈深度学习中的对抗样本及其生成方法
Use of opencv3 6.2 low pass filter
Cvpr19 deep stacked hierarchical multi patch network for image deblurring paper reproduction
Income in the first month of naked resignation
Use of OpenCV 6.4 median filter
随机推荐
多站点高可用部署
Prompt 范式简述
Global and Chinese markets for magnetic resonance imaging (MRI) transmission 2022-2028: Research Report on technology, participants, trends, market size and share
[learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
Matlab数学建模工具
樂理基礎(簡述)
install.img制作方式
Data reverse attack under federated learning -- gradinversion
Use C language to receive JSON strings
Replace convolution with full connection layer -- repmlp
OpenCV3 6.3 用滤波器进行缩减像素采样
Income in the first month of naked resignation
Summary of open3d environment errors
Opencv common method source link (continuous update)
浅谈深度学习中的对抗样本及其生成方法
Use of OpenCV 6.4 median filter
Introduction to parameters of CarSim pavement 3D shape file
Open3d learning notes 1 [first glimpse, file reading]
Open3d learning note 3 [sampling and voxelization]
Jetson nano installation tensorflow stepping pit record (scipy1.4.1)