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.css
andangular-panorama.js
(from this repo) to your code. Also don't forget to include the dependenciesangular
andangular-touch
before them. -
Add a dependency to the
angular-panorama
module in your application.angular.module('myApp', ['angular-panorama']);
-
Add a model (e.g.
pages
here) 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 thewidth
to80
. If you don't set the width, it will be 100% by default. -
Add a
div
withng-panorama
attribute 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-index
adds two-way binding to control the panorama position.ng-panorama-background-image
adds background image.ng-panorama-reset
reset 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 .