2017-10-16 187 views
0

我需要水平滚动只在本节中,隐藏垂直滚动禁用垂直滚动在niceScroll的js

我已经试过一切都像在overflow-x:hidden每一件事情,但它不工作。

<html> 
 
    
 
\t <body> 
 
\t 
 
\t \t <div class="boxscroll do-nicescrol" style="height:200px;"> 
 
\t \t <h1>All Complex Ecosystems Have Parasites</h1> 
 
\t \t <p><strong>All Complex Ecosystems Have Parasites</strong></p> 
 
\t \t <p><strong> Cory Doctorow</strong></p> 
 
\t \t <p><strong> [email protected]</strong></p> 
 
\t \t <p><strong> For the O&#8217;Reilly Emerging Technology Conference</strong></p> 
 
\t \t <p><strong> San Diego, California</strong></p> 
 
\t \t <p><strong> 16 March 2005</strong></p> 
 
\t \t <p>&#8212;</p> 
 
\t \t <p>This text is dedicated to the public domain, using a Creative Commons public domain dedication:</p> 
 
\t \t <p>&gt; Copyright-Only Dedication (based on United States law) &gt; &gt; The person or persons who have associated their<br /> 
 
\t \t work with this &gt; document (the &#8220;Dedicator&#8221;) hereby dedicate the entire copyright &gt; in the work of authorship<br /> 
 
\t \t identified below (the &#8220;Work&#8221;) to the &gt; public domain. &gt; &gt; Dedicator makes this dedication for the<br /> 
 
\t \t benefit of the public at &gt; large and to the detriment of Dedicator&#8217;s heirs and successors. &gt; Dedicator intends<br /> 
 
\t \t this dedication to be an overt act of &gt; relinquishment in perpetuity of all present and future rights &gt; under<br /> 
 
\t \t copyright law, whether vested or contingent, in the Work. &gt; Dedicator understands that such relinquishment of all<br /> 
 
\t \t rights &gt; includes the relinquishment of all rights to enforce (by lawsuit &gt; or otherwise) those copyrights in<br /> 
 
\t \t the Work. &gt; &gt; Dedicator recognizes that, once placed in the public domain, the &gt; Work may be freely reproduced,<br /> 
 
\t \t distributed, transmitted, used, &gt; modified, built upon, or otherwise exploited by anyone for any &gt; purpose, commercial<br /> 
 
\t \t or non-commercial, and in any way, including &gt; by methods that have not yet been invented or conceived.</p> 
 
\t \t <p>&#8212;</p> 
 
\t \t <p>AOL hates spam. AOL could eliminate nearly 100 percent of its subscribers&#8217; spam with one easy change: it could simply<br /> 
 
\t \t shut off its internet gateway. Then, as of yore, the only email an AOL subscriber could receive would come from another<br /> 
 
\t \t AOL subscriber. If an AOL subscriber sent a spam to another AOL subscriber and AOL found out about it, they could terminate<br /> 
 
\t \t the spammer&#8217;s account. Spam costs AOL millions, and represents a substantial disincentive for AOL customers to remain<br /> 
 
\t \t with the service, and yet AOL chooses to permit virtually anyone who can connect to the Internet, anywhere in the world,<br /> 
 
\t \t to send email to its customers, with any software at all.</p> 
 
\t \t <p>[&#8230;]</p> 
 
\t \t <p>A free ebook from http://manybooks.net/</p> 
 
\t \t </div> 
 
\t <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> 
 
\t <script src="https://nicescroll.areaaperta.com/wp-content/plugins/jnicescroll/js/jquery.nicescroll.min.js"></script> 
 
\t <script> 
 
\t \t $(document).ready(function(){ 
 
\t \t \t $(".do-nicescrol").niceScroll(); 
 
\t \t }); 
 
\t </script> 
 
\t </body> 
 
</html>

回答

0

细节对于删除脚本Nicescroll的水平滚动您必须将这个选项horizrailenabled:false

所以对于你的情况下脚本是:

$(document).ready(function(){ 
     $(".do-nicescrol").niceScroll("{horizrailenabled:false}"); 
});