-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3244093
commit f13fbd0
Showing
7 changed files
with
116 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
angular | ||
.module('sample-app', [ | ||
'fullPage.js', | ||
'pagePiling.js', | ||
'ui.router' | ||
]); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
;(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('pagePiling.js', []) | ||
.directive('pagePiling', pagePiling); | ||
|
||
pagePiling.$inject = ['$timeout']; | ||
|
||
function pagePiling($timeout) { | ||
var directive = { | ||
restrict: 'A', | ||
scope: {options: '='}, | ||
link: link | ||
}; | ||
|
||
return directive; | ||
|
||
function link(scope, element) { | ||
var pageIndex; | ||
var slideIndex; | ||
|
||
angular.element(element).pagepiling(sanatizeOptions(scope.options)); | ||
|
||
function destroyFullPage() { | ||
var pageElement = angular.element(element); | ||
|
||
pageElement.attr({ | ||
style: '', | ||
}); | ||
|
||
pageElement.find('.section').removeClass('pp-section active pp-table pp-easing'); | ||
|
||
pageElement.find('li').css({ | ||
zIndex: '', | ||
transform: '', | ||
'-webkit-transform': '', | ||
'-moz-transform': '', | ||
'-ms-transform': '' | ||
}); | ||
|
||
pageElement.find('.pp-tableCell').remove(); | ||
|
||
$('#pp-nav').remove(); | ||
} | ||
|
||
function sanatizeOptions(options) { | ||
|
||
options.afterRender = function(){ | ||
//We want to remove the HREF targets for navigation because they use hashbang | ||
//They still work without the hash though, so its all good. | ||
if (options && options.navigation) { | ||
$('#pp-nav').find('a').removeAttr('href'); | ||
} | ||
}; | ||
|
||
//if we are using a ui-router, we need to be able to handle anchor clicks without 'href="#thing"' | ||
$(document).on('click', '[data-menuanchor]', function () { | ||
$.fn.pagepiling.moveTo($(this).attr('data-menuanchor')); | ||
}); | ||
|
||
return options; | ||
} | ||
|
||
var watchNodes = function() { | ||
return element[0].getElementsByTagName('*').length; | ||
}; | ||
|
||
element.on('$destroy', destroyFullPage); | ||
} | ||
} | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters