Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from puttyman/master
Browse files Browse the repository at this point in the history
Fixed Affix directive has a flickering bug in IE8-IE11. #13
  • Loading branch information
mg committed May 19, 2015
2 parents b9b0546 + e7ce90d commit 17626ae
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
14 changes: 12 additions & 2 deletions dist/ngScrollSpy.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ Licence: MIT

mod.service('ScrollSpy', function($window) {
var rawData= function(w) {
// Fix for IE browsers
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY?redirectlocale=en-US&redirectslug=DOM%2Fwindow.scrollY for more info
var innerWidth = w.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var innerHeight = w.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var supportPageOffset = w.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");

var scrollX = supportPageOffset ? w.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
var scrollY= supportPageOffset ? w.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;

// retrieve interesting data
var raw= {
width: w.innerWidth,
height: w.innerHeight,
maxWidth: w.document.body.scrollWidth,
maxHeight: w.document.body.scrollHeight,
posX: w.scrollX,
posY: w.scrollY
posX: w.scrollX || w.pageXOffset || w.document.documentElement.scrollLeft,
posY: w.scrollY || w.pageYOffset || w.document.documentElement.scrollTop
};

// remove but log overscroll
Expand Down
18 changes: 14 additions & 4 deletions dist/ngScrollSpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ Licence: MIT

mod.service('ScrollSpy', function($window) {
var rawData= function(w) {
// Fix for IE browsers
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY?redirectlocale=en-US&redirectslug=DOM%2Fwindow.scrollY for more info
var innerWidth = w.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var innerHeight = w.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var supportPageOffset = w.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");

var scrollX = supportPageOffset ? w.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
var scrollY= supportPageOffset ? w.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;

// retrieve interesting data
var raw= {
width: w.innerWidth,
height: w.innerHeight,
maxWidth: w.document.body.scrollWidth,
maxHeight: w.document.body.scrollHeight,
posX: w.scrollX,
posY: w.scrollY
posX: w.scrollX || w.pageXOffset || w.document.documentElement.scrollLeft,
posY: w.scrollY || w.pageYOffset || w.document.documentElement.scrollTop
};

// remove but log overscroll
Expand Down Expand Up @@ -379,7 +389,7 @@ mod.directive('pageitems', function(ScrollSpy) {
}

var pos = spyElem.getBoundingClientRect().top;
if (Math.floor(pos) <= topmargin) {
if (pos <= topmargin) {
// the window has been scrolled past the top of a spy element
spy.pos = pos;

Expand Down Expand Up @@ -559,4 +569,4 @@ mod.directive('pagemenuspy', function($location, $anchorScroll) {
});

function getState() { return state; }
})(angular);
})(angular);
2 changes: 1 addition & 1 deletion dist/ngScrollSpy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/scrollspy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
mod.service('ScrollSpy', function($window) {
var rawData= function(w) {
// Fix for IE browsers
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY?redirectlocale=en-US&redirectslug=DOM%2Fwindow.scrollY for more info
var innerWidth = w.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var innerHeight = w.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var supportPageOffset = w.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");

var scrollX = supportPageOffset ? w.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
var scrollY= supportPageOffset ? w.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;

// retrieve interesting data
var raw= {
width: w.innerWidth,
Expand Down

0 comments on commit 17626ae

Please sign in to comment.