Skip to content

Commit

Permalink
2.9.6 - fix for IE7/IE8
Browse files Browse the repository at this point in the history
- IE7/IE8, scrollbar displayed on wrong position for NaN value as border width (issues inuyaksa#47 inuyaksa#48)
  • Loading branch information
inuyaksa committed Jul 11, 2012
1 parent 467a99d commit 7c12b75
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 161 deletions.
8 changes: 4 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jquery.nicescroll
v. 2.9.5 07-02-2012
v. 2.9.6 07-11-2012
copyright 2011-12 InuYaksa*2012
licensed under the MIT
http://areaaperta.com/nicescroll
Expand All @@ -11,9 +11,9 @@ Nicescroll as a Greasemonkey plugin: http://userscripts.org/scripts/show/119910

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 desktop browser: Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+. (all A-grade browsers)
Compatible with mobile device: iPad/iPhone/iPod, Android 2.2+, Blackberry phones and Playbook (WebWorks/Table OS), Windows Phone 7.5 Mango.
So you have scrollable divs with momentum for iPad 4+ and you have consistent scrollable areas for all desktop and mobile platforms.
Compatible with desktop browser: Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+. (all A-grade browsers)
Compatible with mobile device: iPad/iPhone/iPod, Android 2.2+, Blackberry phones and Playbook (WebWorks/Table OS), Windows Phone 7.5 Mango.
So you have scrollable divs with momentum for iPad 4+ and you have consistent scrollable areas for all desktop and mobile platforms.

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.

Expand Down
20 changes: 0 additions & 20 deletions changelog_2.9.5.txt

This file was deleted.

7 changes: 7 additions & 0 deletions changelog_2.9.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Changelog nicescroll release 2.9.6
http://areaaperta.com/nicescroll
https://github.com/inuyaksa/jquery.nicescroll


Fixes
- IE7/IE8, scrollbar displayed on wrong position for NaN value as border width (issues #47 #48)
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
// $("#boxscroll").niceScroll({touchbehavior:false,cursorcolor:"#00F",cursoropacitymax:0.7,cursorwidth:11,cursorborder:"1px solid #2848BE",cursorborderradius:"8px"}).cursor.css({"background-image":"url(img/mac6scroll.png)"}); // MAC like scrollbar

$("#boxscroll2").niceScroll("#contentscroll2",{cursorcolor:"#F00",cursoropacitymax:0.7,boxzoom:true,touchbehavior:true}); // Second scrollable DIV
$("#boxframe").niceScroll("#boxscroll3",{cursorcolor:"#0F0",cursoropacitymax:0.7,boxzoom:true}); // This is an IFrame (iPad compatible)
$("#boxframe").niceScroll("#boxscroll3",{cursorcolor:"#0F0",cursoropacitymax:0.7,boxzoom:true,touchbehavior:true}); // This is an IFrame (iPad compatible)

$("#boxscroll4").niceScroll("#boxscroll4 .wrapper",{boxzoom:true}); // hw acceleration enabled when using wrapper

Expand Down
130 changes: 65 additions & 65 deletions demo/js/jquery.nicescroll.min.js

Large diffs are not rendered by default.

39 changes: 34 additions & 5 deletions jquery.nicescroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* jquery.nicescroll
-- version 2.9.5
-- version 2.9.6
-- copyright 2011-12 InuYaksa*2012
-- licensed under the MIT
--
Expand Down Expand Up @@ -49,7 +49,7 @@

var self = this;

this.version = '2.9.5';
this.version = '2.9.6';
this.name = 'nicescroll';

this.me = me;
Expand Down Expand Up @@ -389,14 +389,43 @@
return (el!==false);
};

//inspired by http://forum.jquery.com/topic/width-includes-border-width-when-set-to-thin-medium-thick-in-ie
var _convertBorderWidth = {"thin":1,"medium":3,"thick":5};
function getWidthToPixel(dom,prop,chkheight) {
var wd = dom.css(prop);
var px = parseFloat(wd);
if (isNaN(px)) {
px = _convertBorderWidth[wd]||0;
var brd = (px==3) ? ((chkheight)?(self.win.outerHeight() - self.win.innerHeight()):(self.win.outerWidth() - self.win.innerWidth())) : 1; //DON'T TRUST CSS
if (self.isie8&&px) px+=1;
return (brd) ? px : 0;
/*
switch (wd) {
case "thin":
px = (self.isie8) ? 1 : 2;
break;
case "medium":
var brd = (chkheight)?(self.win.outerHeight() - self.win.innerHeight()):(self.win.outerWidth() - self.win.innerWidth()); //DON'T TRUST CSS
px = (brd) ? ((self.isie8) ? 3 : 4) : 0;
break;
case "thick":
px = (self.isie8) ? 5 : 6;
break;
}
*/
}
return px;
};

this.updateScrollBar = function(len) {
if (self.ishwscroll) {
self.rail.css({height:self.win.innerHeight()});
} else {
var pos = self.win.offset();
pos.top+= parseFloat(self.win.css('border-top-width'));
var brd = (self.win.outerWidth() - self.win.innerWidth())/2;
pos.left+= self.win.outerWidth() - parseFloat(self.win.css('border-right-width')) - self.rail.width;
pos.top+= getWidthToPixel(self.win,'border-top-width',true);

// var brd = (self.win.outerWidth() - self.win.innerWidth());
pos.left+= self.win.outerWidth() - getWidthToPixel(self.win,'border-right-width',false) - self.rail.width;

var off = self.opt.railoffset;
if (off) {
Expand Down
Loading

0 comments on commit 7c12b75

Please sign in to comment.