Skip to content

Commit

Permalink
Fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
venkateshwar committed Dec 15, 2016
1 parent 181502f commit 23c0254
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Slim-scroll (_JavaScript Scroll Library)
#Slim-scroll (_JavaScript Scroll Library_)

Slim scroll is a replacement of default scrollbar provided by browsers on Windows. This library lets you design the scroll-bar by using simple css properties. It is created using javascript and css. This will change the style only if the default scrollbar looks ugly.

Expand All @@ -12,7 +12,7 @@ Slim scroll is a replacement of default scrollbar provided by browsers on Window
- Works for Windows. (_Need help to check on other Operating Systems_)
- Easier to color the custom scrollbar using CSS.
- Can animate easily (_check below properties for support_).
- Re-evaluates when the window is resized, vertically.
- Re-evaluates when the container is fluid, vertically.

###How to use:
- To make it work, include `slimscroll.js` in `head` tag.
Expand Down
5 changes: 5 additions & 0 deletions slimscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var slimScroll = function(C, payload){
return;
}
}

// hide the scrollbar temporarily to take the calculations correctly
i[w].setAttribute("style", "overflow: hidden !important");
var q = i.E;
i.h = i[S].offsetHeight;
i.sH = i[w].scrollHeight;
Expand Down Expand Up @@ -224,6 +227,8 @@ var slimScroll = function(C, payload){
setAttr(i[s], 'data-scrollbar', '1');
assignValues();

// Show the default scrollbar to get the scrollbar width
i[w].style.overflow = "";
var scrollBarWidth = i[w].offsetWidth - i[w].clientWidth;
// Stretching the inner container so that the default scrollbar is completely invisible
if(Math.abs(scrollBarWidth) < 5){
Expand Down

0 comments on commit 23c0254

Please sign in to comment.