Set up
You need need to add jQuery to your website. If you are not it already, you can reference itstraight from super-fast Google CDN:
1 | < script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" ></ script > |
And then, reference to the slimScroll itself:
<script type="text/javascript" src="libs/jquery.slimscroll.min.js"></script>
After adding a reference to the jQuery, you can use following code to enable slimScroll on your element or elements. Remember to wrap it in document.onload function, so code is called when DOM is ready.
Example, required html structure:
<div class="some-content-related-div">
<div id="inner-content-div">
<p>Lorem ipsum dolor sit amet, consectetur .... snip</p>
</div>
</div>
Code to attach slimScroll:
$(function()
$('#inner-content-div').slimScroll(
height: '250px'
);
);
Check this demo and usages / download
also you can check jQuery nice scroll bar
jQuery slim Scroll bar
No comments:
Post a Comment