Git Product home page Git Product logo

gscrollbar's Introduction

gscrollbar

jquery custom scrollbar plugin with touch device support, lightweight and easy to use.

usage

initialize

// can also pass an options setting as argument
$('.scroll').gscrollbar();

update

To do an update simply call the plugin again and an initialized element and pass the string update as a first argument. The second argument can be a number, an element or an anchor.

$('#scroll1').gscrollbar('update', 100); // update with a given number

options

$.fn.gscrollbar.defaults = {
    axis: 'y', // vertical or horizontal scrollbar? ( x || y ).
    wheel: 40,  //how many pixels must the mouswheel scroll at a time.
    scroll: true, //enable or disable the mousewheel;
    size: 'auto', //set the size of the scrollbar to auto or a fixed number.
    sizethumb: 'auto' //set the size of the thumb to auto or a fixed number.
};

CSS

.gscrollbar .viewport { 
    overflow: hidden; 
    position: relative; 
}
.gscrollbar .overview {
    list-style: none; 
    position: absolute; 
    left: 0; 
    top: 0; 
    padding: 0; 
    margin: 0; 
}
.gscrollbar .scrollbar{
    position: relative; 
    float: right; 
    width: 10px;
}
.gscrollbar .track {
    background: #f4f4f4;
    height: 100%;
    width: 10px;
    position: relative;
}
.gscrollbar .thumb {
    background: #ccc;  
    height: 20px; 
    width: 10px; 
    cursor: pointer; 
    overflow: hidden; 
    position: absolute;
    border-radius:5px;
    top: 0;
}
.gscrollbar .disable { 
    display: none; 
}

credits

gscrollbar is based on tiny scrollbar and it released under the same license.

The differences between the 2 plugins are the following:

  • Different API
  • gscrollbar inject the DOM it needs, tiny expects it (for every instance)
  • gscrollbar is slightly bigger (2.48 against 2.29 minified)

So not much really, tiny scrollbar is really good I just didn't like having to set up the markup it expects in my documents for each element using it.

Tiny Scrollbar Copyright Notice

/*!
* Tiny Scrollbar 1.66
* http://www.baijs.nl/tinyscrollbar/
*
* Copyright 2010, Maarten Baijs
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-2.0.php
*
* Date: 13 / 11 / 2011
* Depends on library: jQuery
* 
*/

gscrollbar's People

Watchers

James Cloos avatar Ahmed Ali avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.