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

Commit cd6758f

Browse files
author
AngularUI (via TravisCI)
committed
Travis commit : build 418
1 parent 1bee844 commit cd6758f

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

ui-utils-ieshiv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* angular-ui-utils - Swiss-Army-Knife of AngularJS tools (with no external dependencies!)
3-
* @version v0.2.1 - 2015-02-10
3+
* @version v0.2.1 - 2015-02-17
44
* @link http://angular-ui.github.com
55
* @license MIT License, http://www.opensource.org/licenses/MIT
66
*/

ui-utils-ieshiv.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui-utils.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* angular-ui-utils - Swiss-Army-Knife of AngularJS tools (with no external dependencies!)
3-
* @version v0.2.1 - 2015-02-10
3+
* @version v0.2.1 - 2015-02-17
44
* @link http://angular-ui.github.com
55
* @license MIT License, http://www.opensource.org/licenses/MIT
66
*/
@@ -1925,26 +1925,36 @@ angular.module('ui.scrollfix',[]).directive('uiScrollfix', ['$window', function
19251925
return {
19261926
require: '^?uiScrollfixTarget',
19271927
link: function (scope, elm, attrs, uiScrollfixTarget) {
1928-
var top = elm[0].offsetTop,
1928+
var absolute = true,
1929+
shift = 0,
1930+
fixLimit,
19291931
$target = uiScrollfixTarget && uiScrollfixTarget.$element || angular.element($window);
19301932

19311933
if (!attrs.uiScrollfix) {
1932-
attrs.uiScrollfix = top;
1934+
absolute = false;
19331935
} else if (typeof(attrs.uiScrollfix) === 'string') {
19341936
// charAt is generally faster than indexOf: http://jsperf.com/indexof-vs-charat
19351937
if (attrs.uiScrollfix.charAt(0) === '-') {
1936-
attrs.uiScrollfix = top - parseFloat(attrs.uiScrollfix.substr(1));
1938+
absolute = false;
1939+
shift = - parseFloat(attrs.uiScrollfix.substr(1));
19371940
} else if (attrs.uiScrollfix.charAt(0) === '+') {
1938-
attrs.uiScrollfix = top + parseFloat(attrs.uiScrollfix.substr(1));
1941+
absolute = false;
1942+
shift = parseFloat(attrs.uiScrollfix.substr(1));
19391943
}
19401944
}
19411945

1946+
fixLimit = absolute ? attrs.uiScrollfix : elm[0].offsetTop + shift;
1947+
19421948
function onScroll() {
1949+
1950+
var limit = absolute ? attrs.uiScrollfix : elm[0].offsetTop + shift;
1951+
19431952
// if pageYOffset is defined use it, otherwise use other crap for IE
19441953
var offset = uiScrollfixTarget ? $target[0].scrollTop : getWindowScrollTop();
1945-
if (!elm.hasClass('ui-scrollfix') && offset > attrs.uiScrollfix) {
1954+
if (!elm.hasClass('ui-scrollfix') && offset > limit) {
19461955
elm.addClass('ui-scrollfix');
1947-
} else if (elm.hasClass('ui-scrollfix') && offset < attrs.uiScrollfix) {
1956+
fixLimit = limit;
1957+
} else if (elm.hasClass('ui-scrollfix') && offset < fixLimit) {
19481958
elm.removeClass('ui-scrollfix');
19491959
}
19501960
}

0 commit comments

Comments
 (0)