Home >Web Front-end >JS Tutorial >How to use jQuery scroll bar beautification plug-in nicescroll

How to use jQuery scroll bar beautification plug-in nicescroll

php中世界最好的语言
php中世界最好的语言Original
2018-06-07 14:08:152138browse

This time I will show you how to use the jQuery scroll bar beautification plug-in nicescroll, and what are the precautions for using the jQuery scroll bar beautification plug-in nicescroll. The following is a practical case, let's take a look.

The example in this article describes the simple usage of jQuery scroll bar beautification plug-in nicescroll. Share it with everyone for your reference, the details are as follows:

Have you ever encountered this situation: you want to embed a p block in a web page and partially scroll, but the scroll bar is too ugly! ! !

Use jquery.nicescroll to beautify the scroll bar (so easy!!):

First: Download jquery.nicescroll.js. Baidu it! ! ! (Or use the CDN address directly as shown in this example)

Then introduce jquery.nicescroll.js, and use:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>jquery.nicescroll插件</title>
    <style>
      .p{
        width: 300px;
        height: 300px;
        overflow-y: scroll;
        overflow-x: hidden;
      }
    </style>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery.nicescroll/3.7.6/jquery.nicescroll.js" ></script>
    <script>
      $(function(){
         $(".p").niceScroll({cursorcolor:"#cccccc"});
      });
    </script>
  </head>
  <body>
    <p class="p">
      去西藏应该避开雨季,大家都知道西藏属于高原地区,是冻土、流沙、泥石流多发的地段,雨季山体滑坡、落石严重,湖水混浊,行路与景色都不怎么样。所以,最好在5、6、9、10月去比较好。我国西藏地区海拔都在3000米以上,所以去西藏旅游最好带上氧气和预防高原反应的药品,对车辆要认真见车,在西藏境内加油站非常少,最好在200公里左右加一次油。
去内蒙自驾游一般选择7、8月间,可以看看中国最大的草原——呼伦贝尔大草原(海拉尔),锡林格勒、阿尔山、克什克腾、地热、四子王旗、二连浩特口岸、满洲里口岸等。
去河南、河北、山东、四川、青海、陕西、宁夏、甘肃(包括嘉峪关、莫高窟)等地玩儿,一般全年均可,选择4月到11月期间去,不会太冷,最好6、7月份去,还可以避暑。
去新疆,8、9、10月比较好,正是新疆水果最多的时候。
去广东、广西、海南、云南、上海、苏州、杭州、南京、无锡、宁波等地,春天去比较好,可以避开炎热的夏天。
去东北,如北戴河、山海关、辽宁等以夏季为宜。吉林、长白山、雪乡、哈尔滨、漠河、北极村、小兴安岭在冬季1月—2月之间最好,可以观看雪景、冰雕,也是滑雪的好时期。
    </p>
  </body>
</html>

Running effect:

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Summary of how to use state objects in vuex

How to develop angular third-party packages

The above is the detailed content of How to use jQuery scroll bar beautification plug-in nicescroll. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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