Giter Site home page Giter Site logo

photo-viewer's Introduction

PhotoViewer

PhotoViewer is an aggressively optimized and thouroghly tested photo viewer library for App.js. It works across modern mobile browsers (Android 2.2+, iOS 5+).

Try the demo (preferably on your phone, it's easy to be smooth on desktop): http://code.kik.com/photo-viewer/demos/index.html

PhotoViewer is suitable for photo galleries of any size. Under the hood, it only ever handles a maximum of three photos at once, meaning you get the same performance regardless of how large your album is.

Download (minified): photo-viewer.js

Usage

For basic usage, just give the PhotoViewer your page, and some urls to munch on:

App.controller('viewer', function (page, data) {
	var photoViewer = new PhotoViewer(page, data.urls);
});

You can listen to events:

photoViewer.on('flip', function (page) {
	data.index = page;
	App.saveStack();
});

And customize the options to your needs:

var photoViewer = new PhotoViewer(page, urls, {
	// Automatically update the page title as the user swipes through
	// photos?
	automaticTitles: true,
	// Hide the titlebar automatically, using whichever gestures are
	// recognized on the device's native photo viewer.
	autoHideTitle: true,
	// An element used as a placeholder while photos are loading.
	// A duplicate is made each time it is used.
	loadingElm: defaultLoadingElm,
	// Photo index to start at.
	startAt: 0,
});

A complete example of a typical PhotoViewer user:

App.controller('viewer', function (page, data) {
	var photoViewer = new PhotoViewer(page, data.urls, {
		startAt: parstInt(data.index, 10),
	});
	photoViewer.on('flip', function (page) {
		data.index = page;
		App.saveStack();
	});
});
App.load('viewer', {
	urls: ['funny-cat-picture.jpg', 'funny-lolcat.jpg'],
	index: 1,
});

photo-viewer's People

Contributors

crazy2be avatar jackread avatar jairajs89 avatar

Watchers

 avatar  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.