Your Ad Here

JScrollPane is a jQuery plugin that allows us to give a visual aspect to the scroll bars of any element, something that Internet Explorer is very simple because it just use CSS but the other browsers has never been implemented, something rare and absurd but there is everything in this world.

To use it, we obviously need to load jQuery from the Google libraries so before </ head> :

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js' /> <script type='text/javascript'

Here is an optional script that will allow us to use the mouse wheel:

<script type='text/javascript' src=' URL_mousewheel.js' />

and finally the plugin itself, either in its standard version or minimized:

<script type='text/javascript' src=' URL_jscrollpane.min.js' />

If you do not want to use external files, the latter two can be added directametne in the template:

<script type='text/javascript'>
//<![ CDATA [
/ / Here paste the contents of mousewheel.js
/ / Here paste the contents of jscrollpane.min.js
//]]>
</ Script>


Like everything else, requires its own rules of style so that it is added below the minimum required although there are more definitions if we use some of the options:

<style>
. JspContainer {
overflow: hidden;
position: relative;
}
. JspPane {position: absolute;}
. JspVerticalBar {
background-color: # 000;
height: 100%;
position: absolute;
right: 0;
top: 0;
width: 16px; / * defines the width of the vertical bar * /
}
. JspHorizontalBar {
background-color: # 000;
bottom: 0;
height: 16px; / * defines the height of the horizontal bar * /
left: 0;
position: absolute;
width: 100%;
}
. JspVerticalBar *,. JspHorizontalBar * {margin: 0; padding: 0;}
/ * These are the rules for configuring the plugin * /
. JspTrack {/ * is the box where you move the slider * /
background-color: # 000;
position: relative;
}
. JspDrag {/ * is the slider itself * /
background-color: # 888;
cursor: pointer;
left: 0;
position: relative;
top: 0;
}
. JspHorizontalBar. JspTrack. JspHorizontalBar. JspDrag {
float: left;
height: 100%;
}
</ Style>

With that everything is ready so that we can use it anywhere. To do so, just to define one or more classes, for example:

</ Style>
. Scroll-pane {height: 200px; overflow: auto; width: 100%;}
. Horizontal {height: auto; max-height: 200px;}
</ Style>


<div style="width: 500px;">
<div class="scroll-pane">
<p> ....... content through ... </ P>
</ Div>
</ Div>


<div style="width: 500px;">
<div class="scroll-pane horizontal">
<p style="width: 1000px;"> ....... content through ... </ P>
</ Div>
</ Div>

And call the function using the class that we defined:

<script type="text/javascript">
$ (Function () {$ ('. Scroll-pane'). JScrollPane ();});
</ Script>

The possibilities are multiple, in the developer page there are several explanatory demos which combines the bar, you add buttons, etc.