Skip to content

Commit

Permalink
Released version 0.2.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
oblador committed Mar 11, 2014
1 parent c133e8a commit 9e86f9b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions angular-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,14 @@ directive('duScrollspy', function($rootScope, scrollPosition) {
toBeActive = toBeActive.spy;
}
if(currentlyActive === toBeActive) return;
if(currentlyActive) currentlyActive.$element.removeClass('active');
if(toBeActive) toBeActive.$element.addClass('active');
if(currentlyActive) {
currentlyActive.$element.removeClass('active');
$rootScope.$broadcast('duScrollspy:becameInactive', currentlyActive.$element);
}
if(toBeActive) {
toBeActive.$element.addClass('active');
$rootScope.$broadcast('duScrollspy:becameActive', toBeActive.$element);
}
currentlyActive = toBeActive;
}

Expand All @@ -228,8 +234,9 @@ directive('duScrollspy', function($rootScope, scrollPosition) {

return {
link: function ($scope, $element, $attr) {
if (!$attr.href || $attr.href.indexOf('#') === -1) return;
var targetId = $attr.href.replace(/.*(?=#[^\s]+$)/, '').substring(1);
var href = $attr.ngHref || $attr.href;
if (!href || href.indexOf('#') === -1) return;
var targetId = href.replace(/.*(?=#[^\s]+$)/, '').substring(1);
if(!targetId) return;

var spy = new Spy(targetId, $element, -($attr.offset ? parseInt($attr.offset, 10) : 0));
Expand Down
2 changes: 1 addition & 1 deletion angular-scroll.min.js

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

2 changes: 1 addition & 1 deletion angular-scroll.min.js.map

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

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-scroll",
"version": "0.2.6",
"version": "0.2.7",
"main": "angular-scroll.min.js",
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-scroll",
"version": "0.2.6",
"version": "0.2.7",
"description": "Scrollspy, animated scrollTo and scroll events",
"keywords": ["angular", "smooth-scroll", "scrollspy", "scrollTo", "scrolling"],
"main": "angular-scroll.min.js",
Expand Down

0 comments on commit 9e86f9b

Please sign in to comment.