Skip to content

Commit

Permalink
added slide to column functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders Nysom authored and Anders Nysom committed Feb 12, 2016
1 parent b67d349 commit 4180cdf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions www/js/GridColumnCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@
}
}

//will slide to the page that currently displays the element indicated by the index
function slideToElementIndex(index) {
//find out which page the element is presented on.
var itemsPrSlide = slideWidth / colItemWidth;
var pageIndex = Math.floor(index / itemsPrSlide);
slideToPage(pageIndex);
}

function onIndicatorClick(e) {
slideToPage(getIndex(e.currentTarget));
}
Expand All @@ -213,7 +221,7 @@
this.slide = function(page) {
//if argument is number, call slideToPage directly
if(typeof page === 'number') {
slideToPage(page);
slideToElementIndex(page);
return;
}

Expand Down Expand Up @@ -261,7 +269,7 @@

//This will reinstantiate the entire carousel. Remove old state and find
//list items and calculating item sizes.
this.reinitialize = reinitialize;
this.reinstantiate = reinstantiate;
}

w.GCCarousel = GCCarousel;
Expand Down

0 comments on commit 4180cdf

Please sign in to comment.