Skip to content

Commit c0a28e3

Browse files
committed
added good names
(all lower case)
1 parent 68088c3 commit c0a28e3

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

angular-fullpage.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
;(function() {
2+
'use strict';
3+
4+
angular
5+
.module('fullPage.js', [])
6+
.directive('fullPage', fullPage);
7+
8+
fullPage.$inject = ['$timeout', '$window'];
9+
10+
function fullPage($timeout, $window) {
11+
var directive = {
12+
restrict: 'A',
13+
scope: {options: '='},
14+
link: link
15+
};
16+
17+
return directive;
18+
19+
function link(scope, element, attrs) {
20+
21+
var rebuild = function() {
22+
destroyFullPage();
23+
24+
angular.element(element).fullpage(sanatizeOptions(scope.options));
25+
};
26+
27+
var destroyFullPage = function() {
28+
if ($.fn.fullpage.destroy) {
29+
$.fn.fullpage.destroy('all');
30+
}
31+
};
32+
33+
var sanatizeOptions = function(options) {
34+
if (options && options.navigation) {
35+
options.afterRender = function() {
36+
37+
//We want to remove the HREF targets for navigation because they use hashbang
38+
//They still work without the hash though, so its all good.
39+
$('#fp-nav').find('a').removeAttr('href');
40+
};
41+
}
42+
43+
//if we are using a ui-router, we need to be able to handle anchor clicks without 'href="#thing"'
44+
$(document).on('click', '[data-menuanchor]', function () {
45+
$.fn.fullpage.moveTo($(this).attr('data-menuanchor'));
46+
});
47+
48+
return options;
49+
};
50+
51+
scope.$watch('options', rebuild, true);
52+
53+
element.on('$destroy', destroyFullPage);
54+
}
55+
}
56+
57+
})();

angular-fullpage.min.js

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

0 commit comments

Comments
 (0)