Created
June 12, 2012 09:40
-
-
Save geelen/2916546 to your computer and use it in GitHub Desktop.
Iphone test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PosterCtrl = ($scope) -> | |
$scope.posters = [ | |
title: "Blade Runner" | |
url: "http://cf2.imgobject.com/t/p/w500/keDKC1r2SyA6uDkEzzVyH8xUzW8.jpg" | |
, | |
title: "Labyrinth" | |
url: "http://cf2.imgobject.com/t/p/w500/40D6CVNGYbIgg7Sdt1jAYkFA08d.jpg" | |
, | |
title: "Jaws" | |
url: "http://cf2.imgobject.com/t/p/w500/l1yltvzILaZcx2jYvc5sEMkM7Eh.jpg" | |
, | |
title: "Rear Window" | |
url: "http://cf2.imgobject.com/t/p/w500/hgHLIpB7wPS2buqjge5edKJKZyR.jpg" | |
] | |
$scope.selectedIndex = 0 | |
$scope.didFlick = -> | |
console.log "flicked to position #{$scope.selectedIndex}!" | |
angular.module("flickable-demo", []) | |
.directive "ngFlickable", -> | |
(scope, element, attrs) -> | |
$(element[0]).flickable { | |
segments: 4, | |
onStart: -> #scope.$apply('flicking = true'), | |
onEnd: -> #scope.$apply('flicking = false') | |
onScroll: (eventData, selectedIndex) -> | |
scope.selectedIndex = selectedIndex | |
scope.didFlick() | |
#scope.$apply() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 5 | |
%html(ng-app="flickable-demo") | |
%head | |
%meta(name='viewport' content='initial-scale=1.0, user-scalable=no, width=device-width') | |
%meta(name="apple-mobile-web-app-capable" content="yes") | |
%meta(name="apple-mobile-web-app-status-bar-style" content="black-translucent") | |
%title Iphone Test | |
%script(src='http://code.angularjs.org/angular-1.0.0rc10.min.js') | |
%script(src='http://zeptojs.com/zepto.min.js') | |
%script(src='https://raw.github.com/tomlongo/Flickable.js/master/src/zepto.flickable.min.js') | |
%script(src='/application.js') | |
%link(href='https://raw.github.com/necolas/normalize.css/master/normalize.css' rel='stylesheet') | |
%link(href='/screen.css' rel='stylesheet') | |
%body(ng-controller="PosterCtrl") | |
#stage | |
#posters(ng-flickable) | |
.poster(ng-repeat="poster in posters") | |
%h2 {{poster.title}} | |
%img(ng-src="{{poster.url}}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
} | |
#stage { | |
width: 320px; | |
height: 416px; | |
overflow: hidden; | |
} | |
#posters { | |
width: 4*250px; | |
//overflow: hidden; | |
margin-left: 35px; | |
margin-top: (416px - 375) / 2; | |
} | |
.poster { | |
width: 250px; | |
height: 375px; | |
float: left; | |
position: relative; | |
>* { | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment