Enables asNavFor
option for Flickity, where one gallery is navigation or another.
<div class="gallery gallery-a">
...
</div>
<div class="gallery gallery-b">
...
</div>
// options
asNavFor: '.gallery-a'
// set as a selector string
asNavFor: document.querySelector('.gallery-a')
// set as an element
Add as-nav-for.js
to your scripts, after including Flickity.
<script src="https://unpkg.com/flickity-as-nav-for@3/as-nav-for.js"></script>
npm: npm install flickity-as-nav-for
Yarn: yarn add flickity-as-nav-for
$('.gallery-a').flickity();
$('.gallery-b').flickity({
asNavFor: '.gallery-a'
});
var flktyA = new Flickity('.gallery-a');
var flktyB = new Flickity( '.gallery-b', {
asNavFor: '.gallery-a'
});
<div class="gallery gallery-a js-flickity">
...
</div>
<div class="gallery gallery-b js-flickity"
data-flickity-options='{ "asNavFor": ".gallery-a" }'>
...
</div>
Bower: bower install flickity-as-nav-for --save
npm: npm install flickity-as-nav-for
const Flickity = require('flickity');
require('flickity-as-nav-for');
var flktyA = new Flickity('.gallery-a');
var flktyB = new Flickity( '.gallery-b', {
asNavFor: '.gallery-a'
});
MIT license
By Metafizzy