📜  如何禁用滚动条而不使用 jQuery 隐藏?

📅  最后修改于: 2021-11-25 03:45:03             🧑  作者: Mango

位于页面角落的垂直或水平条帮助我们向上、向下或横向滚动页面或容器。因此,该过程是禁用滚动条但滚动条应该是可见的。在本文中,我们将使用.on()函数禁用滚动条。单击按钮,我们将使滚动条可见但禁用。

禁用带按钮的 jQuery:这里一旦我们禁用滚动事件,无论我们是否想让滚动条可见,滚动都将不起作用。我们将通过单击按钮触发禁用函数。

句法:

$(“selector”).on(event, function)

示例:此示例说明了使用可见性禁用滚动的方法。



  

    
        How to disable scrollbar without
        hiding using jQuery?
    
      
    
      
    
      
    

  

    
        

GeeksforGeeks

        

A Computer Science portal for Geeks

                   
                           jQuery:                            
                jQuery is an open source JavaScript library                  that simplifies the interactions between an                 HTML/CSS document, or more precisely the                 Document Object Model (DOM), and JavaScript.                 Elaborating the terms, jQuery simplifies HTML                 document traversing and manipulation, browser                  event handling, DOM animations, Ajax interactions,                 and cross-browser JavaScript development.             
        
        
                            

    
  

输出:

  • 在单击按钮之前滚动正在工作:
  • 单击按钮后滚动不起作用:

注意:鼠标滚动被禁用,但如果您单击向下或向上滚动按钮,框架将移动。