当前位置: 首页 > news >正文

上海推牛网络科技有限公司百度快照优化排名推广怎么做

上海推牛网络科技有限公司,百度快照优化排名推广怎么做,聊城b2b网站建,二手房在哪个网站做合同其原理主要是利用JavaScript中的鼠标事件来控制CSS样式。大致就是监听某个DOM元素的鼠标按下事件,以及按下之后的移动事件和松开事件。在鼠标按下且移动过程中,可实时获得鼠标的X轴坐标的值,通过简单计算,可计算出目标元素的宽度&…

其原理主要是利用JavaScript中的鼠标事件来控制CSS样式。大致就是监听某个DOM元素的鼠标按下事件,以及按下之后的移动事件和松开事件。在鼠标按下且移动过程中,可实时获得鼠标的X轴坐标的值,通过简单计算,可计算出目标元素的宽度,然后再用CSS赋值就实现该效果了。

一、示例代码

<template><div class="index"><div class="index-left" ref="indexLeftRef"><div class="index-left-box"></div><div class="left-resize-bar">⋮</div></div><div class="index-middle" ref="indexRightRef"><div class="index-middle-box"><div class="left-view-more" @click="handleViewMoreLeftClick"><div class="left-view-more-false" v-if="!isExpandLeft" /><div class="left-view-more-true" v-else /></div><div class="index-middle-box_main"></div><div class="right-view-more" @click="handleViewMoreRightClick"><div class="right-view-more-false" v-if="!isExpandRight" /><div class="right-view-more-true" v-else /></div></div></div><div class="index-right" ref="indexRightRef"><div class="right-resize-bar">⋮</div><div class="index-right-box"></div></div></div>
</template><script setup>
import { onMounted, ref, getCurrentInstance } from 'vue'// 代理对象
const { proxy } = getCurrentInstance()// 左侧是否收起或展开
const isExpandLeft = ref(false)/*** 左侧点击收起或展开事件句柄方法*/
const handleViewMoreLeftClick = async () => {const indexLeftRef = await proxy.$refs.indexLeftRefisExpandLeft.value = !isExpandLeft.valueif (isExpandLeft.value) {indexLeftRef.style.width = '0'indexLeftRef.style.borderRight = '0px solid #dcdfe6'} else {indexLeftRef.style.width = '400px'indexLeftRef.style.borderRight = '1px solid #dcdfe6'}
}// 右侧是否收起或展开
const isExpandRight = ref(false)/*** 右侧点击收起或展开事件句柄方法*/
const handleViewMoreRightClick = async () => {const indexRightRef = await proxy.$refs.indexRightRefisExpandRight.value = !isExpandRight.valueif (isExpandRight.value) {indexRightRef.style.width = '0'indexRightRef.style.borderRight = '0px solid #dcdfe6'} else {indexRightRef.style.width = '400px'indexRightRef.style.borderRight = '1px solid #dcdfe6'}
}/*** 左侧拖动事件句柄方法*/
const handleDragLeftResizeBar = () => {var leftResizeBar = document.getElementsByClassName("left-resize-bar")[0]var wholeArea = document.getElementsByClassName("index")[0]var leftArea = document.getElementsByClassName("index-left")[0]var middleArea = document.getElementsByClassName("index-middle")[0]var rightArea = document.getElementsByClassName("index-right")[0]console.log('leftResizeBar =>', leftResizeBar)console.log('wholeArea =>', wholeArea)console.log('leftArea =>', leftArea)console.log('middleArea =>', middleArea)console.log('rightArea =>', rightArea)// 鼠标按下事件leftResizeBar.onmousedown = function (eventDown) {// 颜色提醒leftResizeBar.style.backgroundColor = "#5e7ce0"leftResizeBar.style.color = "#ffffff"// 鼠标移动事件document.onmousemove = function (eventMove) {let width = eventMove.clientXconsole.log('width =>', width)if (width >= 600) {width = 600 // 设置最大拉伸宽度为600} else if (width <= 0) {// 当拉伸宽度为小于或等于0,最小拉伸宽度为0,同时是否收起图标向右width = 0isExpandLeft.value = true} else {// 当拉伸宽度为大于0且小于600,是否收起图标向左isExpandLeft.value = false}leftArea.style.width = width + 'px'}// 鼠标松开事件document.onmouseup = function (evt) {// 颜色恢复leftResizeBar.style.backgroundColor = "#ffffff"leftResizeBar.style.color = "#40485c"document.onmousemove = nulldocument.onmouseup = nullleftResizeBar.releaseCapture && leftResizeBar.releaseCapture() // ReleaseCapture()函数用于释放该元素捕获的鼠标}leftResizeBar.setCapture && leftResizeBar.setCapture() // setCapture()函数用于设置该元素捕获的鼠标为空// 说明:一般情况下,SetCapture()和ReleaseCapture()函数是成对使用的。在使用SetCapture()函数捕获鼠标之后,需要在适当的时候调用ReleaseCapture()函数释放鼠标,否则可能会导致鼠标失去响应或者其他异常情况return false}
}/*** 右侧拖动事件句柄方法*/
const handleDragRightResizeBar = () => {var rightResizeBar = document.getElementsByClassName("right-resize-bar")[0]var wholeArea = document.getElementsByClassName("index")[0]var leftArea = document.getElementsByClassName("index-left")[0]var middleArea = document.getElementsByClassName("index-middle")[0]var rightArea = document.getElementsByClassName("index-right")[0]console.log('rightResizeBar =>', rightResizeBar)console.log('wholeArea =>', wholeArea)console.log('leftArea =>', leftArea)console.log('middleArea =>', middleArea)console.log('rightArea =>', rightArea)// 鼠标按下事件rightResizeBar.onmousedown = function (eventDown) {// 颜色提醒rightResizeBar.style.backgroundColor = "#5e7ce0"rightResizeBar.style.color = "#ffffff"// 鼠标移动事件document.onmousemove = function (eventMove) {let width = wholeArea.clientWidth - eventMove.clientXif (width >= 600) {width = 600 // 设置最大拉伸宽度为600} else if (width <= 0) {// 当拉伸宽度为小于或等于0,最小拉伸宽度为0,同时是否收起图标向左width = 0isExpandRight.value = true} else {// 当拉伸宽度为大于0且小于600,是否收起图标向右isExpandRight.value = false}rightArea.style.width = width + 'px'}// 鼠标松开事件document.onmouseup = function (evt) {// 颜色恢复rightResizeBar.style.backgroundColor = "#ffffff"rightResizeBar.style.color = "#40485c"document.onmousemove = nulldocument.onmouseup = nullrightResizeBar.releaseCapture && rightResizeBar.releaseCapture() // ReleaseCapture()函数用于释放该元素捕获的鼠标}rightResizeBar.setCapture && rightResizeBar.setCapture() // setCapture()函数用于设置该元素捕获的鼠标为空// 说明:一般情况下,SetCapture()和ReleaseCapture()函数是成对使用的。在使用SetCapture()函数捕获鼠标之后,需要在适当的时候调用ReleaseCapture()函数释放鼠标,否则可能会导致鼠标失去响应或者其他异常情况return false}
}onMounted(() => {handleDragLeftResizeBar()handleDragRightResizeBar()
})
</script><style lang="less" scoped>.index {display: flex;flex-direction: row;width: 100%;height: 100%;overflow: hidden;/* ---- ^ 左边 ---- */:deep(.index-left) {position: relative;z-index: 0;display: flex;flex-direction: row;width: 400px;border-right: 1px solid #dcdfe6;.index-left-box {flex: 1;display: flex;flex-direction: column;padding: 7px 0 7px 7px;overflow: hidden;background-color: #f3f6f8;.index-left-box_header {width: 100%;min-width: 400px - 14px;height: auto;.header__navbar {display: flex;width: 100%;align-items: center;font-size: 13px;text-align: center;margin-bottom: 7px;.header__navbar_panorama {flex: 1;margin-right: 5px;padding: 5px 0;border: 1px solid #dcdfe6;transition: all ease 0.3s;cursor: pointer;}.header__navbar_product {flex: 1;margin-left: 5px;padding: 5px 0;border: 1px solid #dcdfe6;transition: all ease 0.3s;cursor: pointer;}.header__navbar_panorama:hover,.header__navbar_product:hover{border: 1px solid #5e7ce0;}.header__navbar_actived {background-color: #5e7ce0;border: 1px solid #5e7ce0;color: #fff;}}.header__form {border-top: 1px solid #dcdfe6;padding-top: 7px;}}.index-left_content {flex: 1;overflow: hidden;border: 1px solid #dcdfe6;}}.left-resize-bar {display: flex;align-items: center;width: 7px;height: 100%;background-color: rgb(255, 255, 255);cursor: col-resize;user-select: none;transition: all ease 0.3s;font-size: 20px;color: #40485c;&:hover {color: #fff !important;background-color: #5e7ce0 !important;}}}/* ---- / 左边 ---- *//* ---- ^ 中间 ---- */:deep(.index-middle) {position: relative;z-index: 1;flex: 1;height: 100%;position: relative;transition: all ease 0.3s;background-color: #ffffff;.index-middle-box {display: flex;position: relative;width: 100%;height: 100%;overflow: hidden;// ^ 是否收起左侧边栏的图标.left-view-more {width: 12px;height: 30px;background-color: #ccc;border-bottom-right-radius: 4px;border-top-right-radius: 4px;position: absolute;display: block;margin: auto;left: 0;top: 0;bottom: 0;cursor: pointer;z-index: 1;transition: all ease 0.3s;&:hover {background-color: #5e7ce0;}.left-view-more-true {width: 100%;height: 10px;position: absolute;display: block;margin: auto;left: 0;right: 0;top: 0;bottom: 0;&::before {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;top: 0;background-color: #fff;transform: rotate(70deg);}&::after {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;bottom: 0;background-color: #fff;transform: rotate(-70deg);}}.left-view-more-false {width: 100%;height: 10px;position: absolute;display: block;margin: auto;left: 0;right: 0;top: 0;bottom: 0;&::before {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;top: 0;background-color: #fff;transform: rotate(-70deg);}&::after {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;bottom: 0;background-color: #fff;transform: rotate(70deg);}}}// / 是否收起左侧边栏的图标// ^ 是否收起右侧边栏的图标.right-view-more {width: 12px;height: 30px;background-color: #ccc;border-bottom-left-radius: 4px;border-top-left-radius: 4px;position: absolute;display: block;margin: auto;right: 0;top: 0;bottom: 0;cursor: pointer;z-index: 1;transition: all ease 0.3s;&:hover {background-color: #5e7ce0;}.right-view-more-true {width: 100%;height: 10px;position: absolute;display: block;margin: auto;left: 0;right: 0;top: 0;bottom: 0;&::before {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;top: 0;background-color: #fff;transform: rotate(-70deg);}&::after {display: block;height: 2px;width: 10px;content: "";position: absolute;left: 0;bottom: 0;background-color: #fff;transform: rotate(70deg);}}.right-view-more-false {width: 100%;height: 10px;position: absolute;display: block;margin: auto;left: 0;right: 0;top: 0;bottom: 0;&::before {display: block;height: 2px;width: 10px;content: "";position: absolute;right: 0;top: 0;background-color: #fff;transform: rotate(70deg);}&::after {display: block;height: 2px;width: 10px;content: "";position: absolute;right: 0;bottom: 0;background-color: #fff;transform: rotate(-70deg);}}}// / 是否收起右侧边栏的图标}}/* ---- / 中间 ---- *//* ---- ^ 右边 ---- */:deep(.index-right) {position: relative;z-index: 0;display: flex;flex-direction: row;width: 400px;border-left: 1px solid #dcdfe6;.right-resize-bar {display: flex;align-items: center;width: 7px;height: 100%;background-color: rgb(255, 255, 255);cursor: col-resize;user-select: none;transition: all ease 0.3s;font-size: 20px;color: #40485c;&:hover {color: #fff !important;background-color: #5e7ce0 !important;}}.index-right-box {flex: 1;display: flex;flex-direction: column;padding: 7px 7px 7px 0;overflow: hidden;background-color: #f3f6f8;}}/* ---- / 右边 ---- */}
</style>

二、效果如下 ~

 


文章转载自:
http://katangese.jqLx.cn
http://flappable.jqLx.cn
http://vespertilionine.jqLx.cn
http://cot.jqLx.cn
http://ambiversion.jqLx.cn
http://frig.jqLx.cn
http://synergic.jqLx.cn
http://underfeed.jqLx.cn
http://trawler.jqLx.cn
http://dorsetshire.jqLx.cn
http://deb.jqLx.cn
http://cqd.jqLx.cn
http://lend.jqLx.cn
http://mucoprotein.jqLx.cn
http://chugalug.jqLx.cn
http://mopy.jqLx.cn
http://bricolage.jqLx.cn
http://ectomorphic.jqLx.cn
http://sundries.jqLx.cn
http://granivore.jqLx.cn
http://disrespectful.jqLx.cn
http://mammary.jqLx.cn
http://hung.jqLx.cn
http://snowman.jqLx.cn
http://coreless.jqLx.cn
http://favous.jqLx.cn
http://unglove.jqLx.cn
http://infernal.jqLx.cn
http://kaszube.jqLx.cn
http://palliative.jqLx.cn
http://reactor.jqLx.cn
http://courant.jqLx.cn
http://californiana.jqLx.cn
http://interstitial.jqLx.cn
http://pander.jqLx.cn
http://preclear.jqLx.cn
http://tetraxile.jqLx.cn
http://photographica.jqLx.cn
http://leaseholder.jqLx.cn
http://castellar.jqLx.cn
http://titanomachy.jqLx.cn
http://facultyman.jqLx.cn
http://americanese.jqLx.cn
http://pinhead.jqLx.cn
http://pilgarlic.jqLx.cn
http://amorite.jqLx.cn
http://beamish.jqLx.cn
http://divulge.jqLx.cn
http://inflectable.jqLx.cn
http://closing.jqLx.cn
http://houseroom.jqLx.cn
http://keyboard.jqLx.cn
http://retroperitoneal.jqLx.cn
http://clammer.jqLx.cn
http://emplastic.jqLx.cn
http://univalvular.jqLx.cn
http://paloverde.jqLx.cn
http://framing.jqLx.cn
http://gorgerin.jqLx.cn
http://peccability.jqLx.cn
http://azonal.jqLx.cn
http://beadroll.jqLx.cn
http://habitation.jqLx.cn
http://bolshevik.jqLx.cn
http://agnolotti.jqLx.cn
http://calculus.jqLx.cn
http://remindful.jqLx.cn
http://custom.jqLx.cn
http://wakefully.jqLx.cn
http://vorticose.jqLx.cn
http://gauziness.jqLx.cn
http://telpher.jqLx.cn
http://thoughtway.jqLx.cn
http://inequilateral.jqLx.cn
http://seleniferous.jqLx.cn
http://cooer.jqLx.cn
http://crosstie.jqLx.cn
http://nucleoprotein.jqLx.cn
http://woodbine.jqLx.cn
http://hallmark.jqLx.cn
http://alpeen.jqLx.cn
http://paradoxist.jqLx.cn
http://retropulsion.jqLx.cn
http://sphenographic.jqLx.cn
http://septimus.jqLx.cn
http://eureka.jqLx.cn
http://ligula.jqLx.cn
http://digit.jqLx.cn
http://homochromatic.jqLx.cn
http://trothplight.jqLx.cn
http://cipherkey.jqLx.cn
http://vicugna.jqLx.cn
http://trend.jqLx.cn
http://incurved.jqLx.cn
http://subduple.jqLx.cn
http://sternward.jqLx.cn
http://chequers.jqLx.cn
http://tace.jqLx.cn
http://glm.jqLx.cn
http://antisepticise.jqLx.cn
http://www.hrbkazy.com/news/81770.html

相关文章:

  • 搬家公司怎么做网站新闻发稿平台有哪些?
  • 哈尔滨站建筑最佳磁力吧cili8
  • 免费一百个空间访客领取网站佛山网站建设技术托管
  • 个人单页网站网络营销企业有哪些公司
  • 团中央智慧团建网站新手如何学seo
  • 仿别人网站在线crm软件
  • 投标网站建设服务承诺收录提交入口网址
  • 网站开发行业竞争大吗搜索引擎优化策略有哪些
  • 微信网页编辑器成都seo网站qq
  • 大连哪里做网站好优化推广服务
  • 做网站学哪些语言网站模版
  • 塘下网站建设百度惠生活怎么做推广
  • wordpress国主题公园网站点击排名优化
  • 广告行业做网站哪个好seo外贸推广
  • 网站建设意义国外引流推广软件
  • 网站首页被k 做跳转黄页引流推广网站入口
  • adobe做网站的是哪个软件大丰seo排名
  • wordpress 显示相册国外网站seo免费
  • wap仿制网站教程百度网站下载安装
  • 青岛建设工程信息网站百度seo 站长工具
  • 做兼职在什么网站上找企业宣传网站
  • 阿里巴巴日文网站建设代理百度关键词权重查询
  • 手机信息分类网站制作精准数据营销方案
  • 温州高端网站建设公司重庆网站优化排名推广
  • 沈阳酒店团购网站制作自己的网站怎么建立
  • 创新 反腐倡廉网站建设十大软件免费下载网站排行榜
  • 佛山医疗网站建设怎样做搜索引擎推广
  • 有没有返利网站做京东的网站seo分析报告案例
  • 双语网站系统重庆快速排名优化
  • 苹果网站字体百度一下你就知道移动官网