Skip to content

Commit b00fdaf

Browse files
committed
Merge pull request rochal#199 from free-javascript/master
merging added option if element is already hovered
2 parents 195f7d1 + 75763c0 commit b00fdaf

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ Demo and more: http://rocha.la/jQuery-slimScroll
77
Copyright (c) 2011 Piotr Rochala (http://rocha.la)
88
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
99

10+
added option over librarry of rochal
11+
jQuery('#scroll').slimScroll({
12+
height: jQuery(window).height()+'px', //if you want whole page containing div to get scroll it's a trick only
13+
mouseOver:true // if element you want to scroll will already hovered then make it true else no need to mention it.
14+
});

jquery.slimscroll.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
// sets rail color
4949
railColor : '#333',
5050

51+
//if already mouse is there
52+
mouseOver:false,
53+
54+
// sets animation status on a given scroll
55+
animate: false,
56+
5157
// sets rail opacity
5258
railOpacity : .2,
5359

@@ -333,6 +339,18 @@
333339
if (!releaseScroll) { e.returnValue = false; }
334340
}
335341

342+
//if element is allready hovered
343+
if(o.mouseOver){
344+
rail.trigger('hover')
345+
}
346+
347+
// scroll content
348+
if (o.animate){
349+
me.animate({ scrollTop: delta });
350+
}else{
351+
me.scrollTop(delta);
352+
}
353+
336354
function scrollContent(y, isWheel, isJump)
337355
{
338356
releaseScroll = false;

jquery.slimscroll.min.js

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)