当前位置:网站首页>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
边栏推荐
- 王-课外单词
- Erase method in string
- [learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
- I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
- Causes of laptop jam
- 学习写文章格式
- 稀疏矩阵存储
- Organigramme des activités
- Open3d learning notes II [file reading and writing]
- Library function of C language
猜你喜欢

Vs code configuration problem

Using super ball embedding to enhance confrontation training

W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it

静态库和动态库

The internal network of the server can be accessed, but the external network cannot be accessed

Jetson nano installation tensorflow stepping pit record (scipy1.4.1)
![[learning notes] matlab self compiled Gaussian smoother +sobel operator derivation](/img/f1/4afde3a4bf01254b3e3ff8bc659f9c.png)
[learning notes] matlab self compiled Gaussian smoother +sobel operator derivation

St-link connection error invalid ROM table of STM32 difficult and miscellaneous diseases

针对语义分割的真实世界的对抗样本攻击

Specification for package drawing
随机推荐
Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?
11月24号,我们为“满月”庆祝
How to wrap qstring strings
Longest isometric subsequence
樂理基礎(簡述)
Replace convolution with full connection layer -- repmlp
Global and Chinese market of recovery equipment 2022-2028: Research Report on technology, participants, trends, market size and share
多站点高可用部署
Media query usage
The internal network of the server can be accessed, but the external network cannot be accessed
高中数学必修一
Library function of C language
Data reverse attack under federated learning -- gradinversion
Global and Chinese markets for magnetic resonance imaging (MRI) transmission 2022-2028: Research Report on technology, participants, trends, market size and share
Carsim-路面3D形状文件参数介绍
最长等比子序列
Cvpr19 deep stacked hierarchical multi patch network for image deblurring paper reproduction
Open3d learning notes 1 [first glimpse, file reading]
Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
Rhel7 operation level introduction and switching operation