All Projects → lx544690189 → Vue Gemini Scrollbar

lx544690189 / Vue Gemini Scrollbar

Licence: mit
Custom overlay-scrollbars with native scrolling mechanism for web applications基于原生滚动机制的自定义滚动条

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Gemini Scrollbar

React Scroll Shadow
Pure CSS shadow to indicate more content in scrollable area
Stars: ✭ 229 (+131.31%)
Mutual labels:  scroll, scrollbar
Scrollprogress
🛸 Light weight library to observe the viewport scroll position
Stars: ✭ 148 (+49.49%)
Mutual labels:  scroll, scrollbar
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (+118.18%)
Mutual labels:  scroll, scrollbar
react-is-scrolling
Simply detect if users are scrolling in your components in a declarative API
Stars: ✭ 17 (-82.83%)
Mutual labels:  scroll, scrollbar
scrollpup.js
Minimal beautiful bar to show scroll progress. Pure Javascript Plugin.MIT
Stars: ✭ 83 (-16.16%)
Mutual labels:  scroll, scrollbar
React Scrollbars Custom
The best React custom scrollbars component
Stars: ✭ 576 (+481.82%)
Mutual labels:  scroll, scrollbar
Ngx Scrollbar
Custom overlay-scrollbars with native scrolling mechanism
Stars: ✭ 355 (+258.59%)
Mutual labels:  scroll, scrollbar
Vuebar
(🗃️ Archived) Vue 2 directive for custom scrollbar that uses native scroll behavior. Lightweight, performant, customizable and without dependencies. Used successfully in production on https://ggather.com
Stars: ✭ 650 (+556.57%)
Mutual labels:  scroll, scrollbar
Remember Scroll
🎯 A plugin using localStorage to remember element scroll-position when closed the page.
Stars: ✭ 33 (-66.67%)
Mutual labels:  scroll
Lax.js
Simple & lightweight (<4kb gzipped) vanilla JavaScript library to create smooth & beautiful animations when you scroll.
Stars: ✭ 8,274 (+8257.58%)
Mutual labels:  scroll
React Redux Scroll
Stars: ✭ 30 (-69.7%)
Mutual labels:  scroll
Dragscroll
micro library for drag-n-drop scrolling style
Stars: ✭ 989 (+898.99%)
Mutual labels:  scroll
Simpleparallax.js
Simple and tiny JavaScript library that adds parallax animations on any images
Stars: ✭ 1,075 (+985.86%)
Mutual labels:  scroll
Scroll Snap Carousel
Carousel based on CSS Scroll Snap functionality
Stars: ✭ 31 (-68.69%)
Mutual labels:  scroll
Firefox Overlay Scrollbar
A working prototype of custom styleable overlay scrollbars on Firefox 72+.
Stars: ✭ 74 (-25.25%)
Mutual labels:  scrollbar
Ember Perfect Scroll
Perfect scroll component as an Ember cli addon
Stars: ✭ 21 (-78.79%)
Mutual labels:  scrollbar
Android scroll endless
Scroll endless for Android recyclerview
Stars: ✭ 12 (-87.88%)
Mutual labels:  scroll
Core Components
Accessible and lightweight Javascript components
Stars: ✭ 85 (-14.14%)
Mutual labels:  scroll
Materialviewpager
A Material Design ViewPager easy to use library
Stars: ✭ 8,224 (+8207.07%)
Mutual labels:  scroll
Vim Scrollstatus
A Vim plugin to display a scrollbar in the statusline
Stars: ✭ 46 (-53.54%)
Mutual labels:  scrollbar

vue-gemini-scrollbar

license Travis Vue 2.x

NPM

查看demo

介绍

无需配置横向或纵向滚动,自定义滚动条完全按照原生的方式去显示(也就是如果区域存在纵向滚动条,使用它后将替换纵向滚动条)。正因为如此,请不要使用::-webkit-scrollbar来修饰原生滚动条,这样会影响对滚动条宽度的检测。

  • 基于gemini-scrollbar封装的vue组件
  • 基于原生滚动的自定义滚动条
  • 支持IE9+

安装

npm i vue-gemini-scrollbar --save

如需script方式引入,请自行编译,build后在disk文件夹(vue-gemini-scrollbar.js)

npm run build

Attributes

参数 类型 默认值 说明
autoCreate Boolean true 自动创建自定义滚动条
autoshow Boolean false hover时才显示滚动条
forceGemini Boolean false 原生滚动条可见的情况下,强制显示自定义滚动条(开发时会比较有用)
minThumbSize Number 20 滚动条最小长度

注意: createElements参数在这里被强制置为false,不可配置,因为启用它可能会影响Vue的virtual DOM。

Events

事件名称 回调参数 说明
ready geminiScrollbar实例 GeminiScrollbar实例创建
resize - 滚动区域大小调整时触发

Methods

方法名称 说明
create 创建滚动区域
update 重新计算滚动区域大小(vue可以监听并触发组件updated的时候,都不需要你手动去调用它;但是像图片资源的load导致高度变化,你需要在合适的时候去手动调用;)
destroy 移除绑定事件及滚动条元素

如何调用: 监听ready事件,通过回调函数的参数geminiScrollbar实例来调用这些方法

使用

安装组件

import Vue from 'vue'
import GeminiScrollbar from 'vue-gemini-scrollbar'

Vue.use(GeminiScrollbar)

在模板中使用

<GeminiScrollbar
    class="my-scroll-bar">
    content...
</GeminiScrollbar>

注意:只有内容溢出才会有滚动效果

.my-scroll-bar{
    height:200px;
}

添加自己的滚动条样式

/* override gemini-scrollbar default styles */

/* vertical scrollbar track */
.gm-scrollbar.-vertical {
  background-color: #f0f0f0
}

/* horizontal scrollbar track */
.gm-scrollbar.-horizontal {
  background-color: transparent;
}

/* scrollbar thumb */
.gm-scrollbar .thumb {
  background-color: rebeccapurple;
}
.gm-scrollbar .thumb:hover {
  background-color: fuchsia;
}

如何为body设置自定义滚动条

因为vue组件的根元素不能为body,此时可以从Vue.$geminiScrollbar访问到GeminiScrollbar对象,然后你就可以自由使用它了(文档请参考:gemini-scrollbar)。

html {
    height: 100%;
    /* or */
    height: 100vh;
}
var scrollbar = new Vue.$geminiScrollbar({
    element: document.body
}).create();

其他实现

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].