Commit Graph

247 Commits

Author SHA1 Message Date
Hyunje Alex Jun
b5d0958e82 If scrollbar's detached, reinitialise the plugin in update. 2015-02-11 16:00:19 +00:00
Hyunje Alex Jun
c8fe0b9269 Add missing updates in handlers. 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
b000c771af Fix typo in touch handler. 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
a52a945226 Modularise handlers. 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
0acf3602f0 Fix RTL outer width problem.
`offsetWidth` doesn't work for hidden elements.
2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
89c3bdb1cf Fix typos. 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
ee455fafa5 Implement adaptors. 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
6f5a9088aa Replace $.contains with Node.contains
Now completely independent from jQuery.
2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
f8b20a9fc9 Fix typo in helper.removePsClasses 2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
70acad4941 Implment a native event manager.
Now we're about to be independent from jQuery!
2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
95540bdd9e Change to eslint from jshint.
It's way better. Original files have been linted.
2015-02-11 15:53:42 +00:00
Hyunje Alex Jun
fa7e169b9f Separate initialize, update and destroy functions. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
7ab6c5e5ef Fix a CSS bug that an unwanted scrollbar appears. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
427284337f Separate $.one event handler. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
bbab2a3c53 Separate env helpers. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
aa58a8298e Remove variable cleaning. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
1541f73add More independent. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
ff5ca3d804 Remove includePadding option.
It's supported by default.
2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
3f002c49a1 Remove $this. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
a496ff1a75 Make DOM manipulation independent from jQuery. 2015-02-11 15:53:41 +00:00
Hyunje Alex Jun
9a89e73cf9 Separate event class factory module. 2015-02-11 15:53:40 +00:00
Hyunje Alex Jun
6d1f558c02 Separate a class module. 2015-02-11 15:53:40 +00:00
Hyunje Alex Jun
339e478674 Separate main.js into some modules.
Helper functions and the plugin function are separated.
2015-02-11 15:53:40 +00:00
Hyunje Alex Jun
74fc0daf49 Use browserify. 2015-02-11 15:53:17 +00:00
Hyunje Alex Jun
804d94d3a0 Migrate into Gulp. 2015-02-11 15:53:08 +00:00
Hyunje Alex Jun
2fc41e7045 Add a guard to check if activeElement exists. 2015-02-05 19:18:35 +00:00
Hyunje Alex Jun
bd22fc0e58 2014 -> 2015.
Happy new year!
2015-01-08 17:36:54 +00:00
DanielApt
373838d825 Define the used colors as variables 2014-12-16 13:21:16 +00:00
Hyunje Alex Jun
b927c177ca Change how .in-scrolling works.
Now we add `.ps-in-scrolling` class in a container div.
`pointer-events: none;` is also added for the class.
2014-12-09 23:57:52 +00:00
Hyunje Alex Jun
20576ac717 Merge pull request #252 from tkhyn/master
Detects margins around the rails
2014-12-02 11:34:07 +00:00
Hyunje Alex Jun
7ce708216d Small style fixes for preventDefault functions. 2014-12-02 11:24:36 +00:00
DI-john
931be25635 propagate mobile swipe gestures to page where appropriate 2014-12-02 11:00:37 +00:00
Thomas Khyn
74d0fcb1de Detects margins around the rails 2014-11-17 14:18:37 +13:00
tatarinov
a94df46fe3 Removed unnecessary semicolon 2014-11-14 10:25:19 +04:00
tatarinov
20053e9cf1 Renamed 'int' helper in 'getInt' #250 2014-11-14 10:04:07 +04:00
Hyunje Alex Jun
e9fcc0f02a Temporary fix for mousewheel problem of select in FF and IE.
Resolve #247.
2014-11-11 13:29:09 +00:00
Alexandr Subbotin
05b20f45ef decrease mouse handlers count and every-time class checking during mousemove 2014-11-11 13:28:58 +00:00
Hyunje Alex Jun
1849e64122 Remove remaining inline display style.
It caused regression bugs.
2014-11-05 18:51:52 +00:00
Hyunje Alex Jun
f9c3dc0b20 Change name of variable breakingProcess.
It's too ambiguous to understand the purpose of the variable.
2014-10-31 19:25:43 +00:00
Hyunje Alex Jun
aa92487ed3 Clear intervals if the plugin is destroyed. 2014-10-31 19:25:13 +00:00
Hyunje Alex Jun
d24f9bd41b Use scss for stylesheet.
We can build the scss source to .css and .min.css files with the
`grunt build` command.
2014-10-31 02:20:22 +00:00
Konrad Liebig
94be67d998 Don't handle mouse pointer events as touch in IE10 2014-10-30 17:04:20 +01:00
Hyunje Alex Jun
f099448e44 Change how scrollbar rails are being hidden.
Inline CSS change is bad practice.
2014-10-28 18:01:23 +00:00
Hyunje Alex Jun
d0b97e4039 Add selection handler.
Now perfect-scrollbar supports scrolling by selection.
2014-10-28 17:49:16 +00:00
Hyunje Alex Jun
f2342f2678 Change the way to handle event class name.
Use factory pattern to handle it, instead of using + operator of
string.
2014-10-28 16:41:36 +00:00
Hyunje Alex Jun
967c30a5e4 Shouldn't prevent default for touchStart.
Default touch event shouldn't be prevented.
2014-10-28 14:33:07 +00:00
Hyunje Alex Jun
7dd6335965 Filter touch events not to be handled.
In IE 10/11, MSPointer event is fired by mouse. It shouldn't be handled.

Also, Exception has occurred with event.targetTouches, and this commit
fixed it too.
2014-10-24 12:03:55 +01:00
Fedor
3dde3ebb0c Correction for railBorderYWidth calculation 2014-10-22 17:09:45 +04:00
Hyunje Alex Jun
991e664b18 Stop propagation and prevent default for touch events.
Fix #228.
2014-10-21 21:14:23 +01:00
Hyunje Alex Jun
ee4fc96b7a Bind touch handlers only when it's supported.
Fix #227.
2014-10-21 21:06:16 +01:00
Hyunje Alex Jun
65869821c1 Use > CSS selector.
This patch will resolve inner scrollbar problems.
2014-10-21 20:53:55 +01:00
Nicolás Moncada
6ac02fae2b It makes compatible with iframes. 2014-10-14 01:11:06 +01:00
Hyunje Alex Jun
d4ec7fca6d Merge pull request #219 from MathieuLorber/input-in-shadowdom
ShadowDom form elements are considered for preventing scrolling by keyevent
2014-10-14 01:46:03 +02:00
Hyunje Alex Jun
1b1195288b Add ctrl key support for keyboard handler.
Originally written by @wikenator.
2014-10-14 00:29:51 +01:00
loliver
e6590da884 IE Pointer Events
Added support for PointerEvents (and MSPointerEvents) to support touch
in IE10 and 11.

Modified by @noraesae.
2014-10-14 00:13:04 +01:00
Hyunje Alex Jun
e98bfec4f2 Remove IE6 specific fixes.
Just don't use IE6.
2014-10-13 23:47:47 +01:00
Hyunje Alex Jun
f7d90464e0 More code refactoring.
It's never enough.
2014-10-13 23:47:47 +01:00
Hyunje Alex Jun
337c0be9e2 Add int() helper instead of parseInt.
parseInt is a good option for string-int conversion,
but none for float-int conversion because of performance issue.

This is also to make the code clean.
2014-10-13 23:24:20 +01:00
Hyunje Alex Jun
36c988faba Code refactoring. 2014-10-13 23:24:20 +01:00
Mathieu Lorber
a573d2cd9d ShadowDom form elements are considered for preventing scrolling by keyevent 2014-10-01 11:49:16 +02:00
Hyunje Alex Jun
c1b40168f6 Hide scrollbar rails when they're suppressed.
They were displayed even though suppresed. In this patch,
the scrollbar rails won't be displayed unless they're needed.
2014-09-28 01:28:38 +01:00
Hyunje Alex Jun
937463cf75 Change name. 2014-09-24 19:35:43 +01:00
Hyunje Alex Jun
d3181f0b0d Mousewheel fixes for Firefox and IE 10.
Now tested with the latest versions of following browsers.

In OS X:
Chrome
Firefox
Safari

In Windows:
Chrome
Firefox
Internet Explorer 10
Opera
Safari
2014-09-15 22:53:40 +01:00
Hyunje Alex Jun
0fc81dfa83 Remove Firefox hack for MozMousePixelScroll.
It just works fine without it.
2014-09-15 21:53:23 +01:00
Hyunje Alex Jun
1d315786a0 Hide scrollbars while updating to stop affecting geometries.
Scrollbars keep affecting the geometries and it leads to wrong
scrollWidth and scrollHeight. So hide them in advance and show
them again after updating.
2014-09-15 21:45:27 +01:00
Hyunje Alex Jun
cbdccf9736 Remove jquery-mousewheel dependencies.
Tested under OS X.
2014-08-25 00:35:51 +01:00
Hyunje Alex Jun
a022621df8 Change dragging logic.
Using `updateBarSizeAndPosition` instead of manual update of scrollbar
CSS styles.
2014-08-07 13:25:46 +01:00
d42f
c5f442a70e Update perfect-scrollbar.css
remove spaces
2014-07-29 13:56:38 +04:00
Hyunje Alex Jun
3adb98cd40 Merge pull request #174 from ivan1986/patch-1
add maxScrollbarLength.
2014-07-16 18:53:04 +01:00
Martijn Saly
4e90f8c170 Keydown now checks if the event was preventDefault()'ed. 2014-07-16 18:42:40 +01:00
Karol Tomoki Yamazaki
eb13d331d9 Consider border of scrollbar rails.
Fixes #176 https://github.com/noraesae/perfect-scrollbar/issues/176
2014-07-16 18:40:57 +01:00
Ivan Borzenkov
49a2a694b9 add maxScrollbarLength 2014-07-09 21:16:16 +04:00
Šarūnas Dubinskas
fd56fdfe02 Add ps-active-* class on container then scrollbar is active 2014-07-07 10:42:37 +03:00
Hyunje Alex Jun
bd99960ed1 Add missing variables when cleaned. 2014-04-27 11:43:21 +01:00
ahspw
b8231ecd79 add rtl support
Conflicts:
	src/perfect-scrollbar.js
2014-04-27 11:41:14 +01:00
Hyunje Alex Jun
4a8e8066ab Implement opposite-sided scrollbars.
Now when you use `top` for the x-axis scrollbar or `left` for the y-axis
scrollbar, the scrollbars will be displayed on the opposite side.
2014-04-27 11:01:11 +01:00
Hyunje Alex Jun
8d30c29602 Update names and licenses. 2014-04-10 23:39:49 +01:00
Andrey Nikitenko
6559492079 Update perfect-scrollbar.css
prevent scrollbar rail from disappearing when mouse pointer leaves scrollbar area while dragging the scrollbar
2014-04-04 16:24:47 +03:00
Hyunje Alex Jun
0f5384948e Prevent default when using 'useBothWheelAxes' option. 2014-04-02 00:42:00 +09:00
Hyunje Alex Jun
9a589639b0 Merge pull request #119 from noraesae/mousewheel-speed
Change mousewheel delta calculation logic.
2014-04-02 00:26:06 +09:00
Andrew
32718ae9cc As per jQuery docs the innerWidth method is the one that includes padding (https://api.jquery.com/innerWidth/), while the previously used outerWidth includes border width as well (https://api.jquery.com/outerWidth/). Therefore the use of innerWidth makes more sense for getting the container width with padding in the code (plus a setting name includePadding suggest only padding width is taken into account as an extra for container width determination and might be confusing otherwise). The same goes to innerHeight vs outerHeight. 2014-04-01 14:27:54 +03:00
Hyunje Alex Jun
fdcedcbbf5 Apply deltaFactor for the delta calculation of mousewheel. 2014-03-23 06:05:00 +09:00
Hyunje Alex Jun
9225275e6c Don't use 'wheelSpeed' value for keyboard scrolling. 2014-03-23 06:05:00 +09:00
Stephan Richter
1a335902cc Fix scrolling within nested scrollable DIVs.
Fixes https://github.com/noraesae/perfect-scrollbar/issues/101
2014-03-22 11:29:07 -04:00
Hyunje Alex Jun
2ccb8f18d5 Use strict mode for function scopes.
Global strict mode is problematic when the script is concatenated
with non-strict scripts.
2014-03-11 16:09:39 +09:00
Oleg Kalistratov
9420d1b6a9 Add 'includePadding' option (use container outerWidth/outerHeight instead of width/head) 2014-03-10 16:31:50 +09:00
Steve Lamb
fc24bbc631 CommonJS compatibility 2014-03-10 01:41:50 +09:00
Rupert Angermeier
0544fe7241 Fix delta calculation in mouswheel handler
Remove division by 10, makes scrolling slower than in previous versions.
Reverts 88d286957766e981a4f4c720f213164fc0f3f099
2014-03-10 01:41:18 +09:00
Rupert Angermeier
bc6ef6480a Don't scroll by keyevent while form element has focus 2014-03-10 01:41:18 +09:00
Hyunje Alex Jun
04391d4dec Additional typo fix for the patch below. 2014-03-10 01:41:18 +09:00
Ilan
fa03b68938 Fixed typo in CSS: missing space in "-webkit-transition:background-color.2s linear". 2014-03-10 01:41:18 +09:00
Hyunje Alex Jun
fa51f455fe Avoid the 'divide by zero' problem in bindMobileTouchHandler. 2014-03-10 01:41:18 +09:00
Hyunje Alex Jun
aa0b57c51d Change delta calculation in mousewheel handler.
The new version of jquery-mousewheel's delta values are changed,
and should use the new calculation for the values.
2014-03-10 01:41:18 +09:00
Triangle717
a9000d4b6d Update jquery-mousewheel to 3.1.9 2014-01-24 13:37:50 -05:00
Hyunje Alex Jun
f1491e777d Fix the bug that scrollbar rails show when they shouldn't.
Now, the scrollbar rails show even if the content is smaller than the
container. This patch fixes it.
2014-01-22 11:17:29 +09:00
Hyunje Alex Jun
c1c41e6d14 CSS fixes for IE. 2014-01-21 21:38:45 +09:00
Hyunje Alex Jun
b8d8218c03 Add a getEventClassName() function.
Each scrollbar object should have its own event class name. Unless,
When the one scrollbar is destroyed, another one's event will be
unbinded too.

The getEventClassName() function returns a unique event class name.
2014-01-21 12:22:04 +09:00
Andre Siviero
63c6d67ad5 Implemments Home, End, pageUp, pageDown and Spacebar 2014-01-20 20:14:26 -02:00
Hyunje Alex Jun
40b46a4071 Change the scrolling logic.
Add a scroll handler to handle the previously unhandled events,
and remove updateBarSizeAndPosition() where it's not needed anymore.
2014-01-15 00:23:21 +09:00
Hyunje Alex Jun
71838b9f72 Don't prevent the default scrolling for the inactive axis. 2013-12-14 16:33:15 +09:00
Adrian Carneiro
fa806adb55 Added 4 new setting options (suppressScrollX, suppressScrollY, scrollXMarginOffset and scrollYMarginOffset)
Added 4 new setting options (suppressScrollX, suppressScrollY,
scrollXMarginOffset and scrollYMarginOffset)
2013-11-06 15:20:30 -05:00
Hyunje Alex Jun
43c7b22678 Add click handlers on scrollbar rails to scroll to the position. 2013-09-30 23:32:50 +09:00
Hyunje Alex Jun
51db8add43 Implement visible rail feature.
Now the scrollbars are wrapped by rail elements, and
the styles and scripts are heavily changed to implement the feature.
2013-09-30 23:32:50 +09:00
Hyunje Alex Jun
8ea7291469 Implement keyboard scrolling.
Now when the element is hovered by mouse cursor, it can be scrolled
with arrow keys on the keyboard.
2013-09-30 17:24:12 +09:00
Hyunje Alex Jun
c4632c97ed Change the event namespace to 'perfect-scrollbar'.
There's no reason to use 'perfect-scroll'.
It's weird.
2013-09-30 17:04:26 +09:00
Hyunje Alex Jun
18c9517205 Merge pull request #64 from jakubmal/flexible-scroll
Use vertical scroll for horizontal scrollbar if only horizontal scrollbar is present.
2013-09-29 23:47:44 -07:00
Jakub Malinowski
16998f95f1 Added optional useBothWheelAxes to allow more flexible scrolling if only one axe is scrollable 2013-09-28 00:53:57 +02:00
Julien Castelain
067b10d83d Make it AMD compatible 2013-09-20 11:04:29 +02:00
Hyunje Alex Jun
ebef76a2c6 Add unbind for 'document'.
The function call is needed cause there are mouse handlers
for the element.
2013-09-09 10:12:35 +09:00
Hyunje Alex Jun
be5e338869 Update jshintrc.
Added strict, laxcomma and camelcase options.
Removed the es5 option.
2013-08-31 02:24:43 +09:00
Hyunje Alex Jun
cf8cea8b13 Fix that wheelPropagation option doesn't work in Firefox. 2013-08-06 15:14:55 +09:00
Fabian Vogelsteller
74f97e330e reduced the risk of memory leaks 2013-08-06 14:18:21 +09:00
Hyunje Alex Jun
af7194114a Fix Firefox scrolling problem in OS X.
In OS X, there was the problem that the mousewheel event's
preventDefault() doesn't work well. This patch fixes the problem.
2013-08-01 02:03:44 +09:00
Hyunje Alex Jun
123b1d724b Fix the formula between scroll position and scrollbar position.
With @Mordhak's suggestion, fixed the formula to calculate the values.
This patch will resolve the scroll position problem when the
minScrollbarLength setting is applied.
2013-08-01 01:03:33 +09:00
Drew Miller
ab2a018c93 minScrollbarLength setting
I couldn't figure out the rebasing stuff so I just deleted my fork and
redid the work.  I believe I followed the contributing guidlines
correctly as well.
2013-07-17 12:53:02 -04:00
Zeno Zeng
68c297fe2c Use supportsTouch instead of isMobile. 2013-07-08 23:25:24 +09:00
Hyunje Alex Jun
f02f5e89b7 Fix ie6 scrollbar position problem.
This patch is in fact contributed by the idea of @maoziliang.
2013-06-16 17:56:40 +09:00
Hyunje Alex Jun
21d5d4ab63 Separate the function updating the css of scrollbars. 2013-06-16 17:45:37 +09:00
maoziliang
e833f42d02 Fixed the scrollbar height for xp sp3 ie6
set 'font-size:0' for the scrollbar
2013-06-16 17:22:18 +09:00
maoziliang
a52d55957d Add hover handlers for ie6.
Use scripts to add '.hover' class on the `.ps-container` and both
scrollbars when then mouse is over them because :hover is not supported
except 'a' element.
2013-06-16 17:13:20 +09:00
maoziliang
e93d67e754 Add feature to suport ie.
For ie browser, the `.ps-container` element will add extra class `ie`
and `ie<version>`, like `ie6`, `ie7`, `ie8`, etc.
2013-06-16 17:00:12 +09:00
Hyunje Alex Jun
d8c961ee32 Csslint the css file. 2013-06-15 22:04:50 +09:00
Hyunje Alex Jun
3b1c37440e Inhance the scroll logic with mobile touches.
The scroll works only when the user touch and scroll the wrapper div
with just one touch. By this patch, the zoom function will not be
prevented by scrolling content.
2013-06-14 21:57:24 +09:00
Hyunje Alex Jun
eb8f28cd26 JSHint the code.
Missing space.
2013-06-14 21:38:33 +09:00
Hyunje Alex Jun
34a505d319 Remove $content.
It's not used anymore.
2013-06-14 21:35:32 +09:00
Zeno Zeng
d14dfd307e use scrollHeight & scrollWidth to avoid getting the wrong size of the content 2013-06-14 10:13:30 +08:00
itsdrewmiller
351631cfa7 Fixing jumpiness for large scrolls
https://github.com/noraesae/perfect-scrollbar/issues/16
2013-06-12 12:57:43 -03:00
maoziliang
3410cf89be update the destroy method. unbind listeners by event namespace.
This will be convenient for adding new event bind in the file. Do not
worry about forgetting to unbind it.
2013-06-02 11:16:33 +08:00
Ahmad Sherif
d5dd3422cf Wrap core functionality in an each function
If we have many DOM elements that match the PerfectScrollbar selector,
then all elemets get scrolled if one of them is scrolled.
2013-05-22 11:48:51 +02:00
Hyunje Alex Jun
4613c3daee Code refactoring. 2013-05-18 12:41:15 +09:00
Hyunje Alex Jun
4012ce9c8c Prevent scrollbar x from moving out of the container. 2013-05-18 12:21:20 +09:00
etnassoft
4f49b0fa7f Fix bug with mouse wheel 2013-03-21 11:21:20 +01:00
Hyunje Alex Jun
69c37268a1 Apply jshint. 2013-03-14 15:46:12 +09:00
GregDThomas
38b8b818e8 See issue #10 - provide support for optional settings, including prevention of the mousewheel event and the speed of scrolling 2013-03-14 11:36:57 +09:00
Hyunje Alex Jun
aa213398f3 Enhance scroll preventDefault logic.
Now scroll preventDefault works more like default browser scroll.
When the scroll leaches top, bottom, left and right end, don't
prevent default scrolling. For sure, when the content size is
smaller than the container size, also don't prevent default scrolling.
2013-02-16 00:17:23 +09:00
Hyunje Alex Jun
1cdbc9509f Fix missed ';'
In JavaScript, it's the convension that ';' is placed
at the end of statement
2013-02-15 23:58:57 +09:00
David
627b6a6b81 Take into account padding and margins on content
Changed the height and widths calculations of the content div to
include any padding and/or margins.

outerHeight(true) is changed to outerHeight(false).
outerWidth is changed as same.
Fixed by noraesae.
2013-02-15 23:44:20 +09:00
Hyunje Alex Jun
0099bb556c Supports the mobile touch scrolling.
Using touch events, support mobile scrolling with touch.
2013-02-12 22:37:45 +09:00
Hyunje Alex Jun
a6bb9d02a3 Include jquery-mousewheel in src. 2013-02-08 10:35:34 +09:00
David
dacb601f9f Update src/perfect_scrollbar.js
Ensure the panel is at the top after an update where the scroll bars
are removed. Other wise it is possible to get stuck midway down a panel
with no way of scrolling.
2013-02-07 14:29:44 +10:00
Hyunje Alex Jun
1bd0c102db IE support. 2012-11-10 17:30:09 +09:00
Hyunje Alex Jun
db020f1d29 bug fix.
if handler functions are null, don't do anything.
2012-11-10 13:41:31 +09:00
Hyunje Alex Jun
a96c918dc8 Add update and destroy function, enhance css.
this is the release version!
2012-11-10 03:13:47 +09:00
Hyunje Alex Jun
474351752d Add x-axis scroll function. 2012-11-09 01:32:10 +09:00
Hyunje Alex Jun
efe6727e5d Add y-axis scroll function. 2012-11-08 22:22:26 +09:00
Hyunje Alex Jun
ca22fedf65 Add wheel scroll function. 2012-11-06 22:35:27 +09:00
Hyunje Alex Jun
b409aa3ff3 Base source structure. 2012-11-06 22:01:41 +09:00