Giter VIP home page Giter VIP logo

flickity-fullscreen's Introduction

Flickity fullscreen

Enable fullscreen view for Flickity carousels

Install

Add fullscreen.css to your stylesheets and fullscreen.js to your scripts.

Download

CDN

<link rel="stylesheet" href="https://unpkg.com/flickity-fullscreen@1/fullscreen.css">
<script src="https://unpkg.com/flickity-fullscreen@1/fullscreen.js"></script>

Package managers

npm: npm install flickity-fullscreen

Bower: bower install flickity-fullscreen

Usage

Enable fullscreen behavior by setting fullscreen: true in Flickity options.

// jQuery
var $carousel = $('.carousel').flickity({
  fullscreen: true,
});
// vanilla JS
var flkty = $('.carousel').flickity({
  fullscreen: true,
});
<!-- HTML -->
<div class="carousel" data-flickity='{ "fullscreen": true }'>
  ...
</div>

Webpack & Browserify

var Flickity = require('flickity-fullscreen');

var flkty = new Flickity( '.carousel', {
  fullscreen: true,
});

RequireJS

requirejs( [ 'path/to/flickity-fullscreen' ], function( Flickity ) {
  var flkty = new Flickity( '.carousel', {
    fullscreen: true,
  });
});

Style

.is-fullscreen is added to the carousel when fullscreen.

Size cells to take up full height with CSS.

/* normal */
.carousel-cell {
  height: 200px;
}

/* fullscreen */
.carousel.is-fullscreen .carousel-cell {
  height: 100%;
}

Methods

viewFullscreen

Expand carousel to fullscreen.

// jQuery
$carousel.flickity('viewFullscreen');

// vanilla JS
flkty.viewFullscreen();

exitFullscreen

Collapse carousel from fullscreen back to normal size & position.

// jQuery
$carousel.flickity('exitFullscreen');

// vanilla JS
flkty.exitFullscreen();

toggleFullscreen

Expand or collapse carousel fullscreen view.

// jQuery
$carousel.flickity('toggleFullscreen');

// vanilla JS
flkty.toggleFullscreen();

Events

fullscreenChange

Triggered after entering or exiting the fullscreen view.

// jQuery
$carousel.on( 'fullscreenChange.flickity', function( event, isFullscreen ) {...} );

// vanilla JS
flkty.on( 'fullscreenChange', function( isFullscreen ) {...} );
  • event · Event · jQuery event object
  • isFullscreen · Boolean · true if viewing fullscreen, false if exiting fullscreen

By Metafizzy 🌈🐻

flickity-fullscreen's People

Contributors

desandro avatar jstnrs avatar hashchange avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.