当前位置:网站首页>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
边栏推荐
- Summary of one question per day: linked list (continuously updated)
- 乐理基础(简述)
- The internal network of the server can be accessed, but the external network cannot be accessed
- 業務架構圖
- SQL操作数据库语法
- Open3d learning note 3 [sampling and voxelization]
- w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决
- OpenCV常用方法出处链接(持续更新)
- 针对tqdm和print的顺序问题
- 多站点高可用部署
猜你喜欢

Use Matplotlib to draw a preliminary chart

Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
![Open3d learning note 4 [surface reconstruction]](/img/9d/c1c3f2f3d4acd74a2c043571a120b3.png)
Open3d learning note 4 [surface reconstruction]

Several methods of image enhancement and matlab code

OpenCV3 6.2 低通滤波器的使用

包图画法注意规范

图像增强的几个方法以及Matlab代码

Target detection for long tail distribution -- balanced group softmax

Sequence problem for tqdm and print

MySQL optimization
随机推荐
[learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
業務架構圖
Using C language to realize MySQL true paging
Chinese garbled code under vscade
稀疏矩阵存储
使用Matplotlib绘制图表初步
针对语义分割的真实世界的对抗样本攻击
Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
C language implements XML generation and parsing library (XML extension)
SQL server如何卸载干净
Backup, recovery and repair of XFS file system
Introduction to parameters of CarSim pavement 3D shape file
Look for we media materials from four aspects to ensure your creative inspiration
Rhel7 operation level introduction and switching operation
Organigramme des activités
[learning notes] numerical differentiation of back error propagation
OpenCV常用方法出处链接(持续更新)
C语言实现XML生成解析库(XML扩展)
Array and string processing, common status codes, differences between PHP and JS (JS)
Use Matplotlib to draw a preliminary chart