Microfiche.js

With Associates

v1.8.3

Fork me on GitHub

A carousel library made With Associates focusing on performance, simplicity and touch.

Check out our project page on GitHub and the annotated source.


Installation

Download microfiche.js here

Microfiche requires jQuery ~> 1.7

You’ll want to include the following at the appropriate point in your page:

  <script src="path/to/jquery.js"></script>
  <script src="path/to/microfiche.js"></script>
    

Usage

Defaults

$('#default').microfiche();

Options

$('#cyclic').microfiche({ cyclic: true });

$('#buttons').microfiche({ buttons: false });

$('#bullets').microfiche({ bullets: false });

$('#keyboard').microfiche({ keyboard: true });

$('#click').microfiche({ clickToAdvance: true });

Commands

Commands are passed to the microfiche method as options, and may be passed at any point.
In this example, the slideByPages(1) command is performed immediately after Microfiche has finished setting up.

$('#commands').microfiche({ slideByPages: 1 });

$('#commands').microfiche({ slideByPages: -1 })
$('#commands').microfiche({ slideByPages: 1 })
$('#commands').microfiche({ slideToPoint: 0 })
$('#commands').microfiche({ jumpToPoint: 0 })
$('#commands').microfiche({ jumpToPage: 2 })

Events

Microfiche emits the following events:

You can listen for them in the usual way:

  $('#events').microfiche().on('microfiche:willMove microfiche:didMove', function(event) {
    $('#events-console').html(event.type);
  });
  

Event received: -

Talking to Microfiche Directly

Microfiche has some useful methods that return values, and so cannot be used through the aforementioned jQuery style syntax. The microfiche object itself is available via jQuery’ data method.

$('.my-element').data('microfiche');

Methods

  var m = $('#methods').microfiche().data('microfiche');
  m.currentPageIndex() // returns 0-index of the current page
  m.totalPageCount() // returns the number of pages as an integer
  m.min() // returns the minimum (left-most) position
  m.max() // returns the maximum (right-most) position
    

Autoplay

To have Microfiche pause rotation when the user hovers over the carousel, set autopause to true.

  $('#autoplay').microfiche({
    cyclic: true,
    autoplay: 3,
    autopause: true
  });
      

Refresh

To refresh an existing Microfiche’s controls and content to adjust to a new container size, call the refresh method.

$('#refresher').microfiche({ cyclic: true });

$('#refresher').css('width', '340px');
$('#refresher').microfiche({ refresh: true });

RefreshOnResize

To have Microfiche automatically refresh when a window resize event is fired, set a debounce rate in ms for refreshOnResize. A value of true indicates a 250ms debounce.

var r = $('#refreshonresize');
r.microfiche({ refreshOnResize: false });   // no refresh (default) 
r.microfiche({ refreshOnResize: true });    // 250ms debounce
r.microfiche({ refreshOnResize: 0 });       // instant refresh 
r.microfiche({ refreshOnResize: 100 });     // 100ms debounce 
    

Resize your browser window until it's narrower than the example carousel below to see the carousel refresh.

$('#refreshonresize').microfiche({ refreshOnResize: true });
    

Destroy

To remove a microfiche element and all related event handlers, call destroy.

$('.my-slideshow').microfiche({ destroy: true });
// or
$('.my-slideshow').data('microfiche').destroy();
    

NoScroll Align

To define the filmstrip alignment in the event that all items are visible on screen and no scrolling is required, set noScrollAlign to left, center, or right. The default value is left.

$('#noscroll').microfiche({ noScrollAlign: 'center' });
      

$('#noscroll').microfiche({ noScrollAlign: 'left' })
$('#noscroll').microfiche({ noScrollAlign: 'center' })
$('#noscroll').microfiche({ noScrollAlign: 'right' })


Changelog

v1.8.3 (Aug 20, 2015)

v1.8.2 (May 17, 2015)

v1.8.1 (Mar 18, 2015)

v1.8.0 (Mar 19, 2014)

v1.7.0 (Mar 6, 2014)

v1.6.0 (Feb 25, 2014)

v1.5.0 (Feb 10, 2014)

v1.4.0 (Sep 17, 2013)

v1.3.4 (Apr 10, 2013)

v1.3.3 (Jan 18, 2013)

v1.3.2 (Sep 5, 2012)

v1.3.1 (Sep 5, 2012)

v1.3.0 (Aug 31, 2012)

v1.2.2 (Jul 30, 2012)

v1.2.1 (Jun 13, 2012)

v1.2.0 (May 26, 2012)

v1.1.0 (May 21, 2012)

v1.0.0 (May 21, 2012)


License

Copyright (c) 2012-2014 With Associates

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.