Skip to content

Commit

Permalink
👷 v2.0.2; code style refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Jun 16, 2019
1 parent 8466f05 commit 82a0dba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions as-nav-for.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Flickity asNavFor v2.0.1
* Flickity asNavFor v2.0.2
* enable asNavFor for Flickity
*/

Expand Down Expand Up @@ -78,13 +78,15 @@ proto.setNavCompanion = function( elem ) {
};

proto.navCompanionSelect = function( isInstant ) {
if ( !this.navCompanion || !this.navCompanion.selectedCells ) {
// wait for companion & selectedCells first. #8
var companionCells = this.navCompanion && this.navCompanion.selectedCells;
if ( !companionCells ) {
return;
}
// select slide that matches first cell of slide
var selectedCell = this.navCompanion.selectedCells[0];
var selectedCell = companionCells[0];
var firstIndex = this.navCompanion.cells.indexOf( selectedCell );
var lastIndex = firstIndex + this.navCompanion.selectedCells.length - 1;
var lastIndex = firstIndex + companionCells.length - 1;
var selectIndex = Math.floor( lerp( firstIndex, lastIndex,
this.navCompanion.cellAlign ) );
this.selectCell( selectIndex, false, isInstant );
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": "flickity-as-nav-for",
"version": "2.0.1",
"version": "2.0.2",
"description": "Enable asNavFor for Flickity",
"main": "as-nav-for.js",
"dependencies": {
Expand Down

0 comments on commit 82a0dba

Please sign in to comment.