From ff33a7a469745e0dd376310a83151c7a4fbd3b60 Mon Sep 17 00:00:00 2001 From: Sayanee <sayanee@gmail.com> Date: Wed, 15 Jan 2014 17:15:26 +0800 Subject: [PATCH] example completed --- example/js/directives/angular-pdf.js | 6 ++---- example/partials/viewer.html | 3 ++- example/style.css | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/example/js/directives/angular-pdf.js b/example/js/directives/angular-pdf.js index 5797245..4b804db 100644 --- a/example/js/directives/angular-pdf.js +++ b/example/js/directives/angular-pdf.js @@ -8,7 +8,7 @@ templateUrl: function(element, attr) { return attr.templateUrl ? attr.templateUrl : 'partials/viewer.html' }, - link: function (scope) { + link: function (scope, element, attrs) { var url = scope.pdfUrl, pdfDoc = null, pageNum = 1, @@ -19,9 +19,7 @@ windowEl.on('scroll', function() { scope.$apply(function() { - scope.scroll = windowEl.scrollTop(); - console.log('helloooooooooo') - console.log(scope.sroll); + scope.scroll = windowEl[0].scrollY; }); }); diff --git a/example/partials/viewer.html b/example/partials/viewer.html index d076aa3..86abfe3 100644 --- a/example/partials/viewer.html +++ b/example/partials/viewer.html @@ -1,4 +1,4 @@ -<nav ng-class="{'pdf-controls fixed': scroll > 100}"> +<nav ng-class="{'pdf-controls fixed': scroll > 100, 'pdf-controls': scroll <= 100}"> <button ng-click="goPrevious()"><</span></button> <button ng-click="goNext()">></span></button> @@ -10,6 +10,7 @@ <span>Page: </span> <input type="tel" class="form-control" min=1 ng-model="pageNum"> <span> / {{pageCount}}</span> + </nav> <hr> diff --git a/example/style.css b/example/style.css index b408333..6b90ca6 100644 --- a/example/style.css +++ b/example/style.css @@ -1,7 +1,8 @@ +*{box-sizing: border-box;} .wrapper {margin: 0 auto; width: 960px; } -.pdf-controls { width: 100%; display: block;} +.pdf-controls { width: 100%; display: block; background: #eee; padding: 1em;} .rotate0 {-webkit-transform: rotate(0deg); transform: rotate(0deg); } .rotate90 {-webkit-transform: rotate(90deg); transform: rotate(90deg); } .rotate180 {-webkit-transform: rotate(180deg); transform: rotate(180deg); } .rotate270 {-webkit-transform: rotate(270deg); transform: rotate(270deg); } -.fixed {position: fixed; top: 0; left: 0; z-index: 100; width: 100% } +.fixed { position: fixed; top: 0; left: calc(50% - 480px); z-index: 100; width: 100%; padding: 1em; background: rgba(238, 238, 238,.9); width: 960px; }