0
点赞
收藏
分享

微信扫一扫

生活的意义

小飞侠熙熙 2023-07-13 阅读 64
mounted () {
   window.addEventListener('scroll', this.fixedActiveBtn, true)
 },
data () {
    return {
      fixed: false
    }
  },
fixedActiveBtn (e) {
   var scrollTop = e.target.scrollTop
   if (e.target.getAttribute('class') === 'el-main') {
     scrollTop >= 140 ? this.fixed = true : this.fixed = false
   }
 }
<div :class="fixed ? 'phoneBoxfixed':''"></div>
.phoneBoxfixed{
  position: fixed !important;
}
.phoneBox{
  position: absolute;
  right: 40px;
  top: 100px;
  width: 400px;
  height: 750px;
 }
举报

相关推荐

0 条评论