Home > Web Front-end > H5 Tutorial > How to hide the scroll bar in vue.js-div

How to hide the scroll bar in vue.js-div

php中世界最好的语言
Release: 2018-03-27 16:44:56
Original
4403 people have browsed it

This time I will show you how to hide the scroll bar in vue.js-div. What are the precautions for vue.js-div to hide the scroll bar? The following is a practical case, let’s take a look.

The component is wrapped in a height-fixed p

mounted () {
  var bop = document.getElementById(this.id);
  if(bop == undefined){
  return;
  }
  var isFirefox=navigator.userAgent.indexOf("Firefox") 
  if(isFirefox>0){ 
  bop.addEventListener('DOMMouseScroll', function(event) { //火狐
   var evt = window.event || arguments[0]
   if (evt.detail <= -3) { 
   bop.scrollTop=bop.scrollTop-10
   } else if (evt.detail >= 3) {
   bop.scrollTop=bop.scrollTop+10
   }
   evt.stopPropagation();
   evt.preventDefault();
  }, false); 
  }else{
  bop.addEventListener("mousewheel",function(event) {
   var evt = window.event || arguments[0]
   evt.returnValue = false //屏蔽body滚动事件 
   if (evt.wheelDelta <= -120) { 
   bop.scrollTop=bop.scrollTop+40
   } else if (evt.wheelDelta >= 120) {
   bop.scrollTop=bop.scrollTop-40
   }
  })
  } 
 }
 }
Copy after login

I believe you have mastered the method after reading the case in this article. Please pay attention for more exciting things. Other related articles on php Chinese website!

Recommended reading:

Web-side application implements back force refresh

How to use automatic generator in ionic2

The order of operating Vue rendering and plug-in loading

The above is the detailed content of How to hide the scroll bar in vue.js-div. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template