New Revised CSS Library Forums Web Tools
FAQs Awards Usage Terms Contact
Categories
Other Sections
Sweet Ads
Compatibility
Bookmark online:


FF3.5+ IE8+ Opr10+

FaceScroll Custom scrollbar

Author: Dynamic Drive

Description: FaceScroll is a versatile Facebook inspired custom scrollbar script that can be applied to overflowing content on your page, sitting in for the default browser scrollbar. Similar in style and function to the scrollbar found in Facebook's news ticker widget, it can be set to appear only when the mouse rolls over a content. Below lists the major attributes of FaceScroll:

  • Can be set to appear only when the mouse is over the scrollable content.
  • Works on both content with fixed (ie: px) and liquid (ie: precentage) dimensions.
  • Scrollbar automatically readjusts itself in the event of changes to the applied content's dimensions, such as if new content is added to it that increases its height.
  • Scrollbar reacts to the mousewheel of a mouse and the swipe action on tablets. Tested and works on iPhone and Android devices.
  • Scrollbar can be dynamically added to a piece of content (instead of when the page loads).

Demos:

Scrollbar (default style) shows onMouseover

From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology. Gunpowder is classified as a low explosive because of its relatively slow decomposition rate and consequently low brisance. Low explosives deflagrate at subsonic speeds, whereas high explosives detonate, producing a supersonic wave. Ignition of the powder packed behind a bullet must generate enough pressure to force it from the muzzle at high speed, but not enough to rupture the gun barrel. Gunpowder is thus less suitable for shattering rock or fortifications. Gunpowder was widely used to fill artillery shells and in mining and civil engineering to blast rock roughly until the 2nd half of the 19th century, when the first high explosives (nitro-explosives) were discovered. Gunpowder is no longer used in modern explosive military warheads, nor is it used as main explosive in mining operations due to its cost relative to that of newer alternatives like ANFO.

Scrollbar (alternate style), always shown

From Wikipedia- Gunpowder, also known since in the late 19th century as black powder, was the first chemical explosive and the only one known until the mid 1800s.[2] It is a mixture of sulfur, charcoal, and potassium nitrate (saltpeter) - with the sulfur and charcoal acting as fuels, while the saltpeter works as an oxidizer.[3] Because of its burning properties and the amount of heat and gas volume that it generates, gunpowder has been widely used as a propellant in firearms and as a pyrotechnic composition in fireworks. Gunpowder was, according to prevailing academic consensus, discovered in the 9th century in China, attributed to Chinese alchemists searching for an elixir of immortality.[4] This discovery led to the invention of fireworks and the earliest gunpowder weapons in China. In the centuries following the Chinese discovery, gunpowder weapons began appearing in the Arab world, Europe, and India. The consensus is that this was spread from China, through the Middle East, and then into Europe,[5] although there remains some dispute over the amount of Chinese influence on later advancements in gunpowder technology.

- Remove facescroll scrollbar
- Add facescroll scrollbar

Directions: Developer's View

Step 1: Add the below script to the <HEAD> section of your page:

Select All

Download the following external files that make up the script:

Step 2: Then in the BODY of your page, add the below sample HTML block to your page.

Select All

That's it for basic installation.

More Information

To add FaceScroll scrollbar to an element on the page, simply call the function:

$('#elementid').alternateScroll(setting)

in the HEAD section of your page after the document has loaded, where "#elementid" is the ID of the scrollable DIV in question, and setting is a blank object ({ }) containing one or more of the following settings (each separated by a comma):

setting Description
auto-size 

Defaults to: true

Enable or disable the script from auto adding vertical/ horizontal scrollbar to the content based on changes to its dimensions.
hide-bars 

Defaults to: true

Enable or disable the script from automatically hiding the scrollbar when the mouse is not over the content.
easing

Defaults to: easeOutCubic

Sets the type of easing for the scroll action. Default is easeOutCublic. Click here for the list of supported easing keywords and their respective behaviours. For example:

$('#demo2').alternateScroll({ 'easing': 'linear', 'hide-bars': false });

animation-time 

Defaults to: 500

The duration of the scroll animation from start to finish, in milliseconds.
mouse-wheel-sensitivity 

Defaults to: 2

Sets the mouse wheel sensitivity to scrolling the content. defines The larger the number, the less sensitive, and in turn the slower the scroll rate.
bar-class 

Defaults to: ""

Defines the general CSS class to be applied to both the horizontal and vertical scrollbar interface of the script for styling purposes. The default style for the bars added by the script is:

background-color: rgba(0, 0, 0, 0.3); width: 7px; height: 6px; border-radius: 3px; cursor: pointer;

You can add to this style by defining a custom CSS class and setting "bar-class" to it.

The HTML structure of each bar generated by the script looks like the following:

<div><ins></ins></div>

The "ins" element is used to create the bottom of the scrollbar interface.

vertical-bar-class 

Defaults to: ""

Defines the CSS class to be applied to the vertical scrollbar interface of the script to change its look from the default. When defining this class, be sure to also define an additional class that targets the "ins" element of the scrollbar (which make up the bottom portion of the scrollbar), for example:

.customvertical{
width: 20px;
}

.customvertical ins{
width: 20px;
position: absolute;
top: 100%;
}

horizontal-bar-class

Defaults to: ""

Defines the CSS class to be applied to the horizontal scrollbar interface of the script to modify its look from the default.

Methods

Method Description
remove Removes the FaceScroll scrollbar from an element completely. The syntax is:

$('#elementid').alternateScroll('remove')