What is it?

Tiny Scrollbar is a nice and elegant way to enable the scrolling of content on mobile and desktop devices. Its designed to be a dynamic lightweight utility. Furthermore it gives a User Interface Designer a powerful way of enhancing the Ui (user interface) of a website.

It comes in 2 flavours as a vanilla Javascript microlib and as a jQuery plugin.

Browser support differs between the jQuery plugin and the plain Javascript microlib. Specifically, the plain Javascript microlib does not support legacy browsers such as IE6-8. Use the jQuery plugin release if support for those browsers is required.

Features

  • Completely rewritten!
  • IOS and Android support.
  • Available as a jQuery plugin and as a vanilla Javascript microlib.
  • AMD, Node, requirejs and commonjs support.
  • Can scroll vertical or horizontal
  • Supports scrolling by wheel, thumb, track or touch.
  • It has a update method so it can handle (async) content changes.
  • Size of the track and thumb can be set to auto or a fixed number
  • Easy customizable
  • Supports normal scrolling and mobile style invert scrolling.
  • Examples can be seen on this page, by downloading the zip or here
  • Lightweight, small and clean code.
  • Source is on GitHub

Examples

The examples below are all for the jQuery Plugin. You can find some more (advanced and simple) examples here. You can also find a example for the plain javascript library there.

Nonsense

The chart shows how much lessons young people took in sports during 1999 sorted by sport and gender. The most popular sport for boys was football with 67 lessons. Girls do not seem to like football that much they only took 18 lessons. Swimming was the most popular sport for girls with 52 lessons. boys also took an interest in swimming and took 47 lessons. Boys took 59 lessons and girls 50 lessons in cycling. Girls took 28 lessons in roller blading slighly less for the boys with only 25 lessons. boys and girls almost took the same amount of hiking lessons, boys took 22 lessons and girls 24 lessons. The least favorite sport is tennis with only 24 lessons for the boys and 19 lessons for the girls. overall this chart shows that boys practice sports more frequently then girls.

The diagram shows the evolution of the horse over a period of 40 million years. The diagram begins with a tiny creature the size of a dog named eohippus. Eohippus had 4 toes on his feet and a small tail. It took eohippus 10 million years to develop in mesohippus a bigger horse with 2 toes and 1 big toe in the middle on each foot. Also a little bit of mane starts to grow from its neck. 15 million years later mesohippus becomes merychippus with still 2 toes on each foot but a even bigger toe in the middle. Also the manes on its neck a clearly visible. Mesohippus eventually changes in what we know as the horse. The toes are gone because there all combined in one hoof. Also the tail is longer and whats more his manes. Overall the horse doubled in size and gradually developed hoofs instead of toes.

The table shows where students got there money from over a ten year period in the United Kingdom. In 1988/1989 none of the students loaned any money in contrast to 1992/93 where 8% of a students total income was received by loans. Furthermore parental contributions decreased from 38% to 26% While grants stayed the same at 38%. student earnings had a slight increase going from 6% to 7%. Other source of income fell from 24% to 21%. From 1995/1996 student loans continued to rise going up from 14% to 24% in 1998/1999. On the other hand, parental contributions fell down from 22% to about 16%. same as grants going down from 23% to 14%. Earnings went up to 14% only to fall down again in 1998/99 to 12%. At the same time other sources of income went up going from 27% to 34%. Overall a students total income increased from 4395 pounds in 1988/89 to 5575 pounds in 1998/99.

Nonsense

These days sporting champions are more motivated by fame and money. In the past sporting champions were motivated by setting a world record or winning a game. How does this development reflect on young people and does it affect the sport itself? Young people look up against sporting champions so its very important that they set a good example furthermore sporting champions are much more in the media then they were in the past and not just there sporting achievments but also there private life is exposed. on the other i think most young people are not that interested in a sporters private live or his money. They like the game he plays and the way he plays it. Some sporting champions exploit there fame. Beckham for instance, earns millions with football but the big money is earned with ads and interviews and whenever he changes his look its allover the media in contrast to his sport achievements which are hardly ever commented on. In my opinion this is wrong the main thing a sporter should be focusing on is his game. Whats more the media should not pay as much attention to the live of sporter outside his game. Overall i do not think the sports themselves are affected because for example a football club still wants to win and does not care about what a footballer does or his fame as long as he plays good.

The diagram shows the process of how to do a research. First establish why you want to research a subject is it to extend previous research or for personal experience or maybe just out of curiosity. second state a question you will research and will try to answer. Third design the methods, procedures, and techniques to collect and analyze information. In the next stage identify who the readers of your research will be. Following this identify the sources where you will get your information from and the way you will try to obtain it. next collect the data you need. After that analyze the data you have obtained. When all previous points have been completed you can use your findings to draw your conclusions and state what implications your findings may or may not have and give recommendations.


$(document).ready(function()
{
    $("#scrollbar1").tinyscrollbar();
});
                
image 2 image 2 image 2 image 2 image 2 image 2

$(document).ready(function()
{
    // The axis option is for setting the dimension in
    // which the scrollbar should operate.
    //
    $("#scrollbar2").tinyscrollbar({ axis: "x"});
});
                

Nonsense

The chart shows how much lessons young people took in hosting during 1999 sorted by sport and gender. The most popular sport for boys was football with 67 lessons. Girls do not seem to like football that much they only took 18 lessons. Swimming was the most popular sport for girls with 52 lessons. boys also took an interest in swimming and took 47 lessons. Boys took 59 lessons and girls 50 lessons in cycling. Girls took 28 lessons in roller blading slighly less for the boys with only 25 lessons. boys and girls almost took the same amount of hiking lessons, boys took 22 lessons and girls 24 lessons. The least favorite sport is tennis with only 24 lessons for the boys and 19 lessons for the girls. overall this chart shows that boys practice sports more frequently then girls.

The diagram shows the evolution of the horse over a period of 40 million years. The diagram begins with a tiny creature the size of a dog named eohippus. Eohippus had 4 toes on his feet and a small tail. It took eohippus 10 million years to develop in mesohippus a bigger horse with 2 toes and 1 big toe in the middle on each foot. Also a little bit of mane starts to grow from its neck. 15 million years later mesohippus becomes merychippus with still 2 toes on each foot but a even bigger toe in the middle. Also the manes on its neck a clearly visible. Mesohippus eventually changes in what we know as the horse. The toes are gone because there all combined in one hoof. Also the tail is longer and whats more his manes. Overall the horse doubled in size and gradually developed hoofs instead of toes.

The table shows where students got there programming money from over a ten year period in the United Kingdom. In 1988/1989 none of the students loaned any money in contrast to 1992/93 where 8% of a students total income was received by loans. Furthermore parental contributions decreased from 38% to 26% While grants stayed the same at 38%. student earnings had a slight increase going from 6% to 7%. Other source of income fell from 24% to 21%. From 1995/1996 student loans continued to rise going up from 14% to 24% in 1998/1999. On the other hand, parental contributions fell down from 22% to about 16%. same as grants going down from 23% to 14%. Earnings went up to 14% only to fall down again in 1998/99 to 12%. At the same time other sources of income went up going from 27% to 34%. Overall a students total income increased from 4395 pounds in 1988/89 to 5575 pounds in 1998/99.

Nonsense

These days sporting champions are more motivated by fame and money. In the past sporting champions were motivated by setting a world record or winning a game. How does this development reflect on young people and does it affect the sport itself? Young people look up against sporting champions so its very important that they set a good example furthermore sporting champions are much more in the media then they were in the past and not just there sporting achievments but also there private life is exposed. on the other i think most young people are not that interested in a sporters private live or his money. They like the game he plays and the way he plays it. Some sporting champions exploit there fame. Beckham for instance, earns millions with football but the big money is earned with ads and interviews and whenever he changes his look its allover the media in contrast to his sport achievements which are hardly ever commented on. In my opinion this is wrong the main thing a sporter should be focusing on is his game. Whats more the media should not pay as much attention to the live of sporter outside his game. Overall i do not think the sports themselves are affected because for example a football club still wants to win and does not care about what a footballer does or his fame as long as he plays good.

The diagram shows the process of how to do a research. First establish why you want to research a subject is it to extend previous research or for personal experience or maybe just out of curiosity. second state a question you will research and will try to answer. Third design the methods, procedures, and techniques to collect and analyze information. In the next stage identify who the readers of your research will be. Following this identify the sources where you will get your information from and the way you will try to obtain it. next collect the data you need. After that analyze the data you have obtained. When all previous points have been completed you can use your findings to draw your conclusions and state what implications your findings may or may not have and give recommendations.


$(document).ready(function()
{
    // The size of the scrollbar can be set to a
    // fixed number with the size option.
    //
    $("#scrollbar3").tinyscrollbar({ trackSize: 100 });
});
                

Nonsense

The chart shows how much lessons young people took in sports during 1999 sorted by sport and gender. The most popular sport for boys was football with 67 lessons. Girls do not seem to like football that much they only took 18 lessons. Swimming was the most popular sport for girls with 52 lessons. boys also took an interest in swimming and took 47 lessons. Boys took 59 lessons and girls 50 lessons in cycling. Girls took 28 lessons in roller blading slighly less for the boys with only 25 lessons. boys and girls almost took the same amount of hiking lessons, boys took 22 lessons and girls 24 lessons. The least favorite sport is tennis with only 24 lessons for the boys and 19 lessons for the girls. overall this chart shows that boys practice sports more frequently then girls.

The diagram shows the evolution of the horse over a period of 40 million years. The diagram begins with a tiny creature the size of a dog named eohippus. Eohippus had 4 toes on his feet and a small tail. It took eohippus 10 million years to develop in mesohippus a bigger horse with 2 toes and 1 big toe in the middle on each foot. Also a little bit of mane starts to grow from its neck. 15 million years later mesohippus becomes merychippus with still 2 toes on each foot but a even bigger toe in the middle. Also the manes on its neck a clearly visible. Mesohippus eventually changes in what we know as the horse. The toes are gone because there all combined in one hoof. Also the tail is longer and whats more his manes. Overall the horse doubled in size and gradually developed hoofs instead of toes.

The table shows where students got there money from over a ten year period in the United Kingdom. In 1988/1989 none of the students loaned any money in contrast to 1992/93 where 8% of a students total income was received by loans. Furthermore parental contributions decreased from 38% to 26% While grants stayed the same at 38%. student earnings had a slight increase going from 6% to 7%. Other source of income fell from 24% to 21%. From 1995/1996 student loans continued to rise going up from 14% to 24% in 1998/1999. On the other hand, parental contributions fell down from 22% to about 16%. same as grants going down from 23% to 14%. Earnings went up to 14% only to fall down again in 1998/99 to 12%. At the same time other sources of income went up going from 27% to 34%. Overall a students total income increased from 4395 pounds in 1988/89 to 5575 pounds in 1998/99.

Nonsense

These days sporting champions are more motivated by fame and money. In the past sporting champions were motivated by setting a world record or winning a game. How does this development reflect on young people and does it affect the sport itself? Young people look up against sporting champions so its very important that they set a good example furthermore sporting champions are much more in the media then they were in the past and not just there sporting achievments but also there private life is exposed. on the other i think most young people are not that interested in a sporters private live or his money. They like the game he plays and the way he plays it. Some sporting champions exploit there fame. Beckham for instance, earns millions with football but the big money is earned with ads and interviews and whenever he changes his look its allover the media in contrast to his sport achievements which are hardly ever commented on. In my opinion this is wrong the main thing a sporter should be focusing on is his game. Whats more the media should not pay as much attention to the live of sporter outside his game. Overall i do not think the sports themselves are affected because for example a football club still wants to win and does not care about what a footballer does or his fame as long as he plays good.

The diagram shows the process of how to do a research. First establish why you want to research a subject is it to extend previous research or for personal experience or maybe just out of curiosity. second state a question you will research and will try to answer. Third design the methods, procedures, and techniques to collect and analyze information. In the next stage identify who the readers of your research will be. Following this identify the sources where you will get your information from and the way you will try to obtain it. next collect the data you need. After that analyze the data you have obtained. When all previous points have been completed you can use your findings to draw your conclusions and state what implications your findings may or may not have and give recommendations.


$(document).ready(function()
{
    // The size of the scrollbar thumb can be set to a
    // fixed number with the size option.
    //
    $("#scrollbar4").tinyscrollbar({ thumbSize: 15 });
});
                

Onzin klein / Nonsense

Mijn advies is om gedurende het bouwen van de interface van een applicatie rekening te houden met reflow.



Ik heb zelf al van enkele grote webbapplicaties de frontend mogen bouwen. En ben zodoende zelf ook al enkele keren tegen het reflow probleem aangelopen. En de grootste fout die een developer kan maken is om achteraf nog eens te gaan optimaliseren op performance.


Het is dan namelijk vaak te laat om nog grote veranderingen door te voeren aan de structuur of layout.

Onzin klein / Nonsense

Mijn advies is om gedurende het bouwen van de interface van een applicatie rekening te houden met reflow.



Ik heb zelf al van enkele grote webbapplicaties de frontend mogen bouwen. En ben zodoende zelf ook al enkele keren tegen het reflow probleem aangelopen.


En de grootste fout die een developer kan maken is om achteraf nog eens te gaan optimaliseren op performance. Het is dan namelijk vaak te laat om nog grote veranderingen door te voeren aan de structuur of layout.

Onzin middel / Nonsense

In dit onderzoek heb ik geprobeerd een helder beeld te krijgen over Reflow performance. De ondoorgrondelijkheid van een browser maakt dit tot een flinke klus. Browser developers bieden (vrijwel) geen tools voor het analyseren van css en reflow. Wanneer ik ooit weer eens een onderzoek over browsers doe, zal ik zeker eerst strenger kijken naar of wat ik wil aantonen wel duidelijk meetbaar is. Toch ben ik tevreden over het resultaat van de data, die mijn javascript benchmarks verzamelen. Indien er ooit nog eens een vervolgonderzoek komt, zou ik dat het liefst willen richten op mobiele apparaten. Het lijkt mij erg interessant om de verschillende apparaten met elkaar te vergelijken. Vooral omdat de browsers in mobiele telefoons sterke gelijkenis vertonen met de browsers op pc’s. Daarnaast is performance op mobiele apparaten nog belangrijker, omdat er nu eenmaal minder resources aanwezig zijn.

Onzin lang / Nonsense

Ja, ik ben een keer tegen een probleem aangelopen met een grote dashboard applicatie, die wij aan het ontwikkelen waren voor klant. In dit dashboard zaten meerdere grote tables met datums en tijden en andere specifieke data. Naast de tables waren verschillende panelen aanwezig, die konden worden ingeklapt zodat er meer ruimte was voor de hoofdcontent. De layout van deze applicatie kwam min of meer overeen met een programma, dat ook intern draaide. De klant gaf echter aan dat hij de gebruikers interface nog al schokkerig en traag vond reageren. De reden hievoor was de vrij grote table in de hoofdcontent, die elke keer herberekend moest worden tijdens het verschuiven van de balken. De uiteindelijk oplossing was de table een fixed layout mee te geven.

De nieuwe webtechnieken, die er aanzitten te komen geven programmeurs meer mogelijkheden om complexere applicaties te bouwen, die zonder het gebruik van flash vroeger niet mogelijk waren. Het nadeel is wel, dat met het groter worden van de applicaties tegen meer reflow problemen zal worden aangelopen. Nu heb ik in hoofdstuk 1 aangegeven, dat browsers ook hard aan verbetering van de snelheid van rendering werken. De impact, die reflow tijden hebben op de snelheid van een applicatie zou zich dus in grote maten zichzelf moeten oplossen. Het probleem is echter de grote levensspanne die vooral de browsers van microsoft kenmerkt. Zo wordt internet explorer 6 nu al 9 jaar gebruikt. De verwachting is wel, dat de huidige browsers iets sneller uitgefaseerd zullen worden.Maar even goed is er dan nog een gat van +/- 5 jaar, waarin mensen een browser gebruiken die niet klaar is voor al het media geweld dat de nieuwe webstandaarden ons zullen brengen.

Update with tiny text Update with middle text Update with large text Update with middle text relative to the current text. Update with large text relative to the current text. Update with middle text and goto bottom. Update with large text and goto bottom.

var $scrollbar5 = $("#scrollbar5");
$scrollbar5.tinyscrollbar();

// Some madeup function that does changes to the content
// of the scrollbar.
//
setNewContent();

// To compensate for the changes in the content you can
// call the tinyscrollbar update function
//
var scrollbar5 = $scrollbar5.data("plugin_tinyscrollbar")
scrollbar5.update();

                

Onzin verhaal

De beginfase van dit onderzoek bestaat uit een oriëntatie. Door informatie te zoeken over de desbetreffende onderwerpen wordt er meer inzicht verkregen. Vervolgens worden de onderzoeksvragen opgesteld. Deze gegevens worden allemaal verwerkt in een plan van aanpak. Een belangrijk onderdeel van dat document is het afbakenen van het probleemgebied en de onderzoeksopzet. Na het opstellen van dit plan zal er worden begonnen met het verzamelen van informatie uit verschillende bronnen. Op de verkregen informatie moeten enkele benchmarks worden gebaseerd. De gegevens, die deze benchmarks genereren, worden verwerkt tot duidelijke onderzoeksresultaten en vervolgens worden aan de onderzoeksresultaten conclusies verbonden. Er zal ook een stuk kwalitatief onderzoek worden gedaan in de vorm van interviews. Dit zal worden gedaan om meer informatie te krijgen over hoe bedrijven omgaan met de frontend van een website en wat voor problemen zij hierin ervaren. Op basis van deze conclusies, onderzoeksresultatenen en interviews wordt er een samenvattende conclusie en een aanbeveling opgesteld, waarna dit geheel wordt verwerkt tot een onderzoeksrapport.

Ja en nee. Het gebruik van efficiente selectoren heeft zeker wel een positief effect bij reflow issues, maar het beperken van de scope van reflow heeft een veel groter positief effect, omdat de repaint dan ook beperkt blijft en dat vele malen duurder is dan de selector-matching in moderne browsers. Ik ben zelf goed bekend met hoe browsers selectors matchen (bottom-up) en wat dus efficiente selectors zijn en wat niet. Echter binnen onze manier van ontwikkelen, komt het vaak voor dat delen van de site worden voorzien van andere styling,terwijl de rest van de site ongemoeid moet worden gelaten; dat resulteert vaak in het gebruik van steeds specifiekere selectors (specificity-war). Het staat wel op mijn persoonlijke to-do om daar eens goed naar te kijken en selectors te versimpelewaar mogelijk, maar juist de complexiteit van onze site zelf, maakt het vaak lastig om te bepalen of dat geen neven-effecten heeft op andere delen van de site. Al met al denk ik, dat we het nog redelijk goed doen qua grootte van onze CSS files en bij grote design-wijzigingen grijp ik meestal de mogelijkheid ook aan om de CSS (deels) opnieuw te schrijven en efficienter te maken.

Scroll the content to 50px Scroll the content to 200px Scroll the content to 300px

$(document).ready(function()
{
    // You can use the update method to build a anchor.
    //
    var $scrollbar6 = $('#scrollbar6');
    $scrollbar6.tinyscrollbar();

    var scrollbar6 = $scrollbar6.data("plugin_tinyscrollbar");

    // Create a anchor that scrolls the bar to 50 pixels
    // when clicked.
    //
    $('.scrollbar6button').click(function()
    {
        scrollbar6.update(50);

        return false;
    });
});
                

Constructor

tinyscrollbar ( options )
  • options Object
    • axis = 'y' String optional

      Vertical or horizontal scroller? ( x || y ).

    • wheel = true Boolean optional

      Enable or disable the mousewheel.

    • wheelSpeed = 40 Boolean optional

      How many pixels must the mouswheel scroll at a time.

    • wheelLock = true Boolean optional

      Lock default window wheel scrolling when there is no more content to scroll.

    • touchLock = true Number optional

      Lock default window touch scrolling when there is no more content to scroll.

    • trackSize = false Boolean | Number optional

      Set the size of the scrollbar to auto(false) or a fixed number.

    • thumbSize = false Boolean | Number optional

      Set the size of the thumb to auto(false) or a fixed number

    • thumbSizeMin = 20 Boolean optional

      Minimum thumb size.

Properties

_defaults Object private

Default: defaults

_name String private final

Default: 'tinyscrollbar'

contentPosition Number

The position of the content relative to the viewport.

contentRatio Number

The ratio of the content size relative to the viewport size.

contentSize Number

The height or width of the content.

hasContentToSroll Boolean

Will be true if there is content to scroll.

options Object

The options of the carousel extend with the defaults.

thumbPosition Number

The position of the thumb relative to the track.

thumbSize Number

The height or width of the thumb.

trackRatio Number

The size of the track relative to the size of the content.

trackSize Number

The height or width of the content.

viewportSize Number

The height or width of the viewport.

Methods

_drag ()
_end ()
_initialize ()
_isAtBegin ()
_isAtEnd ()
_setCss ()
_setEvents ()
_start ()
_wheel ()
update ( scrollTo )

You can use the update method to adjust the scrollbar to new content or to move the scrollbar to a certain point.

  • scrollTo Number | String optional

    Number in pixels or the values "relative" or "bottom". If you dont specify a parameter it will default to top

Events

move

The move event will trigger when the carousel slides to a new slide.

Usage


$(document).ready(function()
{
    // Initialize a scrollbar like this.
    //
    var $box = $('#box');
    $box.tinyscrollbar();

    // Try this to get access to the actual scrollbar instance.
    //
    var box = $box.data("plugin_tinyscrollbar");

    // Now you have access to all the methods and properties.
    //
    // box.update();
    // console.log(box.contentPosition);
    //
    // etc..

    // You can bind to the move event like this.
    //
    $box.bind("move", function()
    {
        console.log("do something on every move.");
    });
});
                

FAQ

  • When you seem to be missing part of the content. Please make sure all the images have a height and width defined.
  • Use the update method on content changes! It's your friend ;)
  • If your scrollbar + content is on display: none; at page load. Use the update method to enable the scrollbar when its content is visible again.