README 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. jquery.nicescroll
  2. v. 2.9.6 07-11-2012
  3. copyright 2011-12 InuYaksa*2012
  4. licensed under the MIT
  5. http://areaaperta.com/nicescroll
  6. https://github.com/inuyaksa/jquery.nicescroll
  7. https://twitter.com/nicescroll
  8. Nicescroll as a Greasemonkey plugin: http://userscripts.org/scripts/show/119910
  9. Nicescroll (as nice scroll for browsers) is a jquery (since 1.5) plugin, for nice scrollbars with a very similar ios/mobile style.
  10. It supports DIVs, IFrames and document page (body) scrollbars.
  11. Compatible with desktop browser: Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+. (all A-grade browsers)
  12. Compatible with mobile device: iPad/iPhone/iPod, Android 2.2+, Blackberry phones and Playbook (WebWorks/Table OS), Windows Phone 7.5 Mango.
  13. So you have scrollable divs with momentum for iPad 4+ and you have consistent scrollable areas for all desktop and mobile platforms.
  14. Sexy zoom feature, you can "zoom-in" the content of any nicescroll'ed div. Nice to use and nice to see, all the content of the div in fullscreen mode. It works on desktop (double click on div) either in mobile/touch devices using pinch gesture.
  15. On modern browsers hardware accelerated scrolling has implemented.
  16. Using animationFrame for a smoothest and cpu-saving scrolling. (when browser supports)
  17. Only vertical scrollbars supported in this version. (horizotal support on version 3 soon)
  18. Warning for IE6 users (why do you uses IE6 yet? Please updgrade to a more stable and modern browser), some feature can't work for limitation of the browser. Document (body) scrollbars can't appears, old (native browser) one is used. Some issues with IFrame scrolling.
  19. * FEATURES
  20. - simple installation and activation, it works with NO modification of your code. (some exceptions can happen, so you can write to me)
  21. - very stylish scrollbars, with no occupation on your window (original browser scrollbars need some of page space and reduces window/div usable width)
  22. - you can style main document scrollbar (body) too!! (not all script implements this feature)
  23. - on all browsers you can scroll: dragging the cursor, mouse wheel (speed customizable), keyboard navigation (cursor keys, pagup/down keys, home/end keys)
  24. - scroll is smooth (as modern tablet browsing), speed is customizable
  25. - zoom feature
  26. - hardware accelerated scroll (where available)
  27. - animation frame support for smoth scrolling and cpu-saving
  28. - dragging scroll mode with scrolling momentum (as touch device)
  29. - tested for all major browsers desktop and mobile versions
  30. - support for touch devices
  31. - support for multi-input devices (IE10 with MSPointer)
  32. - compatible with many other browsers, including IE6, Safari on Mac and WP7 Mango!
  33. - very customizable aspect of bar
  34. - native scroll events are working yet
  35. - fully integrated with jQuery
  36. - compatibile with jQuery UI, jQuery Touch, jQuery Mobile
  37. * DEPENDENCIES
  38. It's a plugin for the jquery framework, you need to include jquery in your scripts.
  39. From 1.5.x version and on. (you can try with 1.4.2+ also)
  40. * INSTALLATION
  41. Put loading script tag after jquery script tag and loading the zoom image in the same folder of the script:
  42. <script src="jquery.nicescroll.js"></script>
  43. Copy image "zoomico.png" in the same folder of jquery.nicescroll.js.
  44. * HOW TO USE
  45. Recall ALWAYS in (document) ready statement.
  46. 1. Simple mode, it styles document scrollbar:
  47. $(document).ready(
  48. function() {
  49. $("html").niceScroll();
  50. }
  51. );
  52. 2. Instance with object returned:
  53. var nice = false;
  54. $(document).ready(
  55. function() {
  56. nice = $("html").niceScroll();
  57. }
  58. );
  59. 3. Style a DIV and chage cursor color:
  60. $(document).ready(
  61. function() {
  62. $("#thisdiv").niceScroll({cursorcolor:"#00F"});
  63. }
  64. );
  65. 4. DIV with "wrapper", formed by two divs, the first is the vieport, the latter is the content:
  66. $(document).ready(
  67. function() {
  68. $("#viewportdiv").niceScroll("#wrapperdiv",{cursorcolor:"#00F"});
  69. }
  70. );
  71. 5. Get nicescroll object:
  72. var nice = $("#mydiv").getNiceScroll();
  73. 6. Hide scrollbars:
  74. $("#mydiv").getNiceScroll().hide();
  75. * CONFIGURATION PARAMETERS
  76. When you call "niceScroll" you can pass some parameters to custom visual aspects:
  77. . cursorcolor - change cursor color in hex, default is "#000000"
  78. . cursoropacitymin - change opacity very cursor is inactive (scrollabar "hidden" state), range from 1 to 0, default is 0 (hidden)
  79. . cursoropacitymax - change opacity very cursor is active (scrollabar "visible" state), range from 1 to 0, default is 1 (full opacity)
  80. . cursorwidth - cursor width in pixel, default is 5 (you can write "5px" too)
  81. . cursorborder - css definition for cursor border, default is "1px solid #fff"
  82. . cursorborderradius - border radius in pixel for cursor, default is "4px"
  83. . zindex - change z-index for scrollbar div, default value is 9999
  84. . scrollspeed - scrolling speed, default value is 60
  85. . mousescrollstep - scrolling speed with mouse wheel, default value is 40 (pixel)
  86. . touchbehavior - enable cursor-drag scrolling like touch devices in desktop computer, default is false
  87. . hwacceleration - use hardware accelerated scroll when supported, default is true
  88. . boxzoom - enable zoom for box content, default is false
  89. . dblclickzoom - (only when boxzoom=true) zoom activated when double click on box, default is true
  90. . gesturezoom - (only when boxzoom=true and with touch devices) zoom activated when pinch out/in on box, default is true
  91. . grabcursorenabled, display "grab" icon for div with touchbehavior = true, default is true
  92. . autohidemode, how hide the scrollbar works, true=default / "cursor" = only cursor hidden / false = do not hide
  93. . background, change css for rail background, default is ""
  94. . iframeautoresize, autoresize iframe on load event (default:true)
  95. . cursorminheight, set the minimum cursor height in pixel (default:20)
  96. . preservenativescrolling, you can scroll native scrollable areas with mouse, bubbling mouse wheel event (default:true)
  97. . railoffset, you can add offset top/left for rail position (default:false)
  98. . bouncescroll, enable scroll bouncing at the end of content as mobile-like (only hw accell) (default:false)
  99. . spacebarenabled, enable page down scrolling when space bar has pressed (default:true)
  100. . railpadding, set padding for rail bar (default:{top:0,right:0,left:0,bottom:0})
  101. . disableoutline, for chrome browser, disable outline (orange hightlight) when selecting a div with nicescroll (default:true)
  102. * LICENSE
  103. Copyright 2011-12*InuYaksa
  104. Licensed under the MIT License, http://www.opensource.org/licenses/mit-license.php
  105. Images used for zoom icons have derived from OLPC interface, http://laptop.org/8.2.0/manual/Browse_ChangingView.html