Browse Source

Revised README and IE6 fix

A more complete README file, with some examples and a list of custom parameters.
IE6 fix
Inuyaksa 14 years ago
parent
commit
245d9b75a7
4 changed files with 61 additions and 39 deletions
  1. 0 1
      MIT.LICENSE
  2. 49 8
      README
  3. 6 15
      demo/js/jquery.nicescroll.js
  4. 6 15
      jquery.nicescroll.js

+ 0 - 1
MIT.LICENSE

@@ -2,7 +2,6 @@ Open Source Initiative OSI - The MIT License (MIT):Licensing
 [OSI Approved License]
 The MIT License (MIT)
 
-jQuery NiceScroll
 Copyright (c) 2011 InuYaksa
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+ 49 - 8
README

@@ -1,19 +1,36 @@
 jquery.nicescroll
-v. 1.5.0 10-30-2011
+v. 1.5.1 10-30-2011
 copyright 2011 InuYaksa*2011
 licensed under the MIT
 https://github.com/inuyaksa/jquery.nicescroll
 
 
-A jquery (since 1.5) plugin for nice scrollbars as ios/mobile style.
+Nicescroll (as nice scroll for browsers) is a jquery (since 1.5) plugin, for nice scrollbars with a very similar ios/mobile style.
 It supports DIVs, IFrames and document page (body) scrollbars.
-Compatible with Firefox 4+, Chrome 5+, Safari 4+, Opera 10+, IE 8+.
+Compatible with Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+. (all A-grade browsers)
 
-Only vertical scrolls supported in this version.
+Only vertical scrollbars supported in this version.
 
+Warning for IE6 users (who 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.
 
 
-1. How to use (simple):
+* DEPENDENCIES
+It uses jquery framework, since 1.5.x version. (you can try with 1.4.x)
+
+
+* INSTALLATION
+Put loading script tag after jquery script tag:
+
+<script src="jquery.nicescroll.js"></script>
+
+
+* HOW TO USE
+
+Recall ALWAYS in (document) ready statement.
+
+1. Simple mode, it styles document scrollbar:
 
 $(document).ready(
   function() {  
@@ -21,9 +38,7 @@ $(document).ready(
   }
 );
 
-
-
-2. How to use (with object returned):
+2. Style scrollbars wit object returned:
 
 var scrollbars = false;
 $(document).ready(
@@ -32,3 +47,29 @@ $(document).ready(
   }
 );
 
+3. Style a DIV and chage cursor color:
+
+$(document).ready(
+  function() {  
+    $("#thisdiv").niceScroll({cursorcolor:"#00F"});
+  }
+);
+
+
+* CONFIGURATION PARAMETERS
+
+When you call "niceScroll" you can pass some parameters to custom visual aspects:
+
+. cursorcolor - change cursor color in hex, default is "#000000"
+. cursoropacitymin - change opacity very cursor is inactive (scrollabar "hidden" state), range from 1 to 0, default is 0 (hidden)
+. cursoropacitymax - change opacity very cursor is active (scrollabar "visible" state), range from 1 to 0, default is 1 (full opacity)
+. zindex - change z-index for scrollbar div, default value is 9999
+. scrollspeed - scrolling speed, default value is 60
+. mousescrollstep - scrolling speed with mouse wheel, default value is 48 (pixel)
+
+
+* LICENSE
+
+Copyright 2011*InuYaksa
+Licensed under the MIT License, http://www.opensource.org/licenses/mit-license.php
+

+ 6 - 15
demo/js/jquery.nicescroll.js

@@ -24,10 +24,10 @@
       cursoropacitymax:1,
       cursorcolor:"#424242",
       scrollspeed:60,
-      mousescrollstep:8*6,
+      mousescrollstep:8*6
     };
     
-    if (myopt) {
+    if (myopt||false) {
       for(var a in self.opt) {
         if (myopt[a]!==undefined) self.opt[a] = myopt[a];
       }
@@ -168,7 +168,7 @@
         if (!self.rail.drag) self.hideCursor();
       });
       
-      if (!self.isiframe) self.bind(self.docscroll,"mousewheel",self.onmousewheel);
+      if (!self.isiframe) self.bind((self.isie&&self.ispage) ? document : self.docscroll,"mousewheel",self.onmousewheel);
       self.bind(self.rail,"mousewheel",self.onmousewheel);
 
       if (!self.ispage) {
@@ -305,7 +305,7 @@
         if (name=='mousewheel') el.addEventListener("DOMMouseScroll",fn,bubble||false);
       } 
       else if (el.attachEvent) {
-        el.attachEvent(name,fn);
+        el.attachEvent("on"+name,fn);
       } 
       else {
         el["on"+name] = fn;
@@ -333,15 +333,6 @@
       return self.cancelEvent(e);
     };
     
-    this.mousewheel = function(fn) {
-      if (!self.isie) self.bind(self.docscroll,'DOMMouseScroll',self.onmousewheel,false);      
-      self.bind(self.docscroll,'mousewheel',self.onmousewheel,false);
-      if (!self.ispage) {
-        if (!self.isie) self.bind(self.rail,'DOMMouseScroll',self.onmousewheel,false);      
-        self.bind(self.rail,'mousewheel',self.onmousewheel,false);
-      }
-    };
-    
     this.doScroll = function(y) {
       self.newscrolly = y;
       if (self.timer) return;
@@ -402,8 +393,8 @@
   
   $.fn.niceScroll = function(opt) {
     var ret = [];
-    if (opt===undefined) opt = {};
-    var docundef = (opt.doc===undefined);
+    if (typeof opt=="undefined") opt = {};
+    var docundef = !("doc" in opt);
     this.each(function() {      
       opt.doc = (docundef) ? $(this) : opt.doc;
       ret.push(new NiceScrollClass(opt));

+ 6 - 15
jquery.nicescroll.js

@@ -24,10 +24,10 @@
       cursoropacitymax:1,
       cursorcolor:"#424242",
       scrollspeed:60,
-      mousescrollstep:8*6,
+      mousescrollstep:8*6
     };
     
-    if (myopt) {
+    if (myopt||false) {
       for(var a in self.opt) {
         if (myopt[a]!==undefined) self.opt[a] = myopt[a];
       }
@@ -168,7 +168,7 @@
         if (!self.rail.drag) self.hideCursor();
       });
       
-      if (!self.isiframe) self.bind(self.docscroll,"mousewheel",self.onmousewheel);
+      if (!self.isiframe) self.bind((self.isie&&self.ispage) ? document : self.docscroll,"mousewheel",self.onmousewheel);
       self.bind(self.rail,"mousewheel",self.onmousewheel);
 
       if (!self.ispage) {
@@ -305,7 +305,7 @@
         if (name=='mousewheel') el.addEventListener("DOMMouseScroll",fn,bubble||false);
       } 
       else if (el.attachEvent) {
-        el.attachEvent(name,fn);
+        el.attachEvent("on"+name,fn);
       } 
       else {
         el["on"+name] = fn;
@@ -333,15 +333,6 @@
       return self.cancelEvent(e);
     };
     
-    this.mousewheel = function(fn) {
-      if (!self.isie) self.bind(self.docscroll,'DOMMouseScroll',self.onmousewheel,false);      
-      self.bind(self.docscroll,'mousewheel',self.onmousewheel,false);
-      if (!self.ispage) {
-        if (!self.isie) self.bind(self.rail,'DOMMouseScroll',self.onmousewheel,false);      
-        self.bind(self.rail,'mousewheel',self.onmousewheel,false);
-      }
-    };
-    
     this.doScroll = function(y) {
       self.newscrolly = y;
       if (self.timer) return;
@@ -402,8 +393,8 @@
   
   $.fn.niceScroll = function(opt) {
     var ret = [];
-    if (opt===undefined) opt = {};
-    var docundef = (opt.doc===undefined);
+    if (typeof opt=="undefined") opt = {};
+    var docundef = !("doc" in opt);
     this.each(function() {      
       opt.doc = (docundef) ? $(this) : opt.doc;
       ret.push(new NiceScrollClass(opt));