在niceScroll Js中禁用垂直滚动 [英] Disable Vertical Scroll in niceScroll Js

查看:98
本文介绍了在niceScroll Js中禁用垂直滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仅在此部分需要水平滚动并隐藏垂直滚动

我在所有方面都尝试过类似overflow-x:hidden的所有方法,但均无法正常工作.

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

解决方案

要删除脚本 Nicescroll 的水平滚动,必须插入此选项horizrailenabled:false.

因此,您遇到的情况的脚本是:

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

I need horizontal scroll only in this section and hide vertical scroll

I have tried everything like overflow-x:hidden in every thing but its not working.

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

解决方案

For remove the horizontal scroll of script Nicescroll you must insert this option horizrailenabled:false.

So the script for you case is:

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

这篇关于在niceScroll Js中禁用垂直滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆