Skip to content

Commit

Permalink
Prevent wheel propagation optionally with plugin setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoudt committed Feb 28, 2014
1 parent abf110c commit d5098ac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enscroll",
"version": "0.5.7",
"version": "0.6.0",
"main": "js/mylibs/enscroll.js",
"ignore": ["**/*.md", "**/*.png", "**/*.jpg", "**/*.gif", "releases/*", "README", "**/*.html", "**/*.ico", "**/*.txt", "**/*.handlebars"],
"dependencies": {"jquery": ">1.7.1"}
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ <h1>Easily Customize Scrollbars!</h1>
<p>Do you have overflowing boxes with scrollbars on your site? Do you wish you could style those scrollbars to offer your users a consistent look &amp; feel across multiple browsers and platforms? Enscroll is a jQuery plugin that gives you the power to replace those scrollbars rendered by the web browser with ones that you design. Either replace the scrollbars with your own image or use custom CSS to style them anyway you desire.</p>
</div>
<aside role="complementary">
<a id="download-btn" class="cta png" href="releases/enscroll-0.5.7.min.js" download="enscroll-0.5.7.min.js" data-action="enscroll-0.5.7">
<a id="download-btn" class="cta png" href="releases/enscroll-0.6.0.min.js" download="enscroll-0.6.0.min.js" data-action="enscroll-0.6.0">
<h2 class="png">Download</h2>
<b>enscroll-0.5.7.min.js</b>
<b>enscroll-0.6.0.min.js</b>
<b>File Size: 17KB</b>
</a>
<a id="demo-btn" class="cta png" href="#demos" data-tab-link>
Expand Down
5 changes: 3 additions & 2 deletions js/mylibs/enscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
drawScrollButtons: false,
clickTrackToScroll: true,
easingDuration: 500,
propagateWheelEvent: true,
verticalTrackClass: 'vertical-track',
horizontalTrackClass: 'horizontal-track',
horizontalHandleClass: 'horizontal-handle',
Expand Down Expand Up @@ -522,12 +523,12 @@

if ( Math.abs( deltaX ) > Math.abs( deltaY )) {
delta = ( deltaX > 0 ? -scrollIncrement : scrollIncrement ) << 2;
if ( scrollAnimateHorizontal( $pane, delta )) {
if ( scrollAnimateHorizontal( $pane, delta ) || !data.settings.propagateWheelEvent ) {
preventDefault( event );
}
} else {
delta = ( deltaY > 0 ? -scrollIncrement : scrollIncrement ) << 2;
if ( scrollAnimateVertical( $pane, delta )) {
if ( scrollAnimateVertical( $pane, delta ) || !data.settings.propagateWheelEvent ) {
preventDefault( event );
}
}
Expand Down
4 changes: 4 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var enscroll = {
property: 'clickTrackToScroll',
value: 'true',
description: 'If set to true, the view pane will scroll up a page when you click the track above the handle, and scroll down a page when you click the track below the handle'
}, {
property: 'propagateWheelEvent',
value: 'true',
description: 'Normally, scrolling the view pane to the top or bottom with the mouse wheel will cause the wheel event to propagate to its parent. Setting this property to false will prevent this behavior'
}, {
property: 'verticalTrackClass',
value: '\'vertical-track\'',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enscroll",
"version": "0.5.7",
"version": "0.6.0",
"description": "A jQuery plugin for creating custom scrollbars.",
"main": "Gruntfile.js",
"scripts": {
Expand Down
Loading

0 comments on commit d5098ac

Please sign in to comment.