An AngularJS panorama implementation optimised for mobile devices, supporting width setting for each page.
I may add a demo here later...
Comments and contributions welcome :)
-
Add Angular Panorama to your project by:
bower install angular-panorama --save -
Add
angular-panorama.cssandangular-panorama.js(from this repo) to your code. Also don't forget to include the dependenciesangularandangular-touchbefore them. -
Add a dependency to the
angular-panoramamodule in your application.angular.module('myApp', ['angular-panorama']); -
Add a model (e.g.
pageshere) including width values if you need. The width values must be integers, representing percentages. For example, if you want a page to be 80% width of the viewport, just set thewidthto80. If you don't set the width, it will be 100% by default. -
Add a
divwithng-panoramaattribute to your html and wrap a<ul>inside. Every<li>child of this<ul>will become a swipable page with specified width.
<div ng-panorama="pages" ng-panorama-index="index" ng-panorama-reset="reset"
ng-panorama-background-image="backgroundImageUrl">
<ul>
<li ng-repeat="page in pages" style="width: {{page.width}}%;" ng-cloak>
</ul>
</div>You can also use ng-panorama without ng-repeat, or even a mix.
<script>
// in your controller code
$scope.pages = [
{width: 80},
{width: 80},
{width: 80},
{width: 80}
];
</script>
<div ng-panorama="pages" ng-panorama-index="index" ng-panorama-reset="reset"
ng-panorama-background-image="backgroundImageUrl">
<ul>
<li style="width: 80%;">
<li style="width: 80%;">
<li style="width: 80%;">
<li style="width: 80%;">
</ul>
</div>ng-panorama-indexadds two-way binding to control the panorama position.ng-panorama-background-imageadds background image.ng-panorama-resetreset the panorama toindex=0 skipping animation.
- Mobile friendly, tested on Chrome + Android WebView(<4.4)
- Super flexible. Completely rewrited in the {{ angular way }}.
- CSS 3D transformations with GPU accel
Angular Panorama is created by Tong Shen from FotoDish, and is distributed under the MIT license .