Skip to content

Commit

Permalink
Fix when deck is one
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Feb 18, 2015
1 parent 130826a commit 1c56f34
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion dist/skrollr.decks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* skrollr-decks 1.0.2
* skrollr-decks 1.0.3
* Fullpage presentation decks with scrolling
* https://github.com/TrySound/skrollr-decks
*
Expand Down Expand Up @@ -198,6 +198,12 @@
active = nav.getElementsByClassName('skrollable-between'),
el, before, after;

if(active.length === 1) {
el = segments[active[0].getAttribute('data-anchor-target')];
currentDeck !== el && trigger('change', [el])
currentDeck = el;
}

if(active.length === 2) {
before = e.direction === 'up' ? 0 : 1;
after = e.direction === 'up' ? 1 : 0;
Expand Down
4 changes: 2 additions & 2 deletions dist/skrollr.decks.min.js

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

4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
<script src="src/skrollr.decks.js"></script>
<script>

skrollr.decks.on('change', function (active) {
console.log(active);
});

document.querySelector('.main-nav').addEventListener('click', function (e) {
var el = e.target;

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": "skrollr-decks",
"version": "1.0.2",
"version": "1.0.3",
"description": "Fullpage presentation decks with scrolling",
"main": "gulpfile.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/skrollr.decks.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@
active = nav.getElementsByClassName('skrollable-between'),
el, before, after;

if(active.length === 1) {
el = segments[active[0].getAttribute('data-anchor-target')];
currentDeck !== el && trigger('change', [el])
currentDeck = el;
}

if(active.length === 2) {
before = e.direction === 'up' ? 0 : 1;
after = e.direction === 'up' ? 1 : 0;
Expand Down

0 comments on commit 1c56f34

Please sign in to comment.