From 0d221b30f1a2f3222f7a71845f1a72daaa17db57 Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Mon, 5 Sep 2016 23:32:08 -0400 Subject: [PATCH] Initial commit to pages --- example/angular-simple-slideshow.css | 12 +++++ example/angular-simple-slideshow.js | 70 ++++++++++++++++++++++++++++ example/example-app.js | 6 +++ example/slideshow-example.html | 20 ++++++++ 4 files changed, 108 insertions(+) create mode 100644 example/angular-simple-slideshow.css create mode 100644 example/angular-simple-slideshow.js create mode 100644 example/example-app.js create mode 100644 example/slideshow-example.html diff --git a/example/angular-simple-slideshow.css b/example/angular-simple-slideshow.css new file mode 100644 index 0000000..1084926 --- /dev/null +++ b/example/angular-simple-slideshow.css @@ -0,0 +1,12 @@ +/* SLIDESHOW */ +#slideshow-wrap {} +#slideshow-wrap .slide-container {width:40%; float:left;} +#slideshow-wrap .slide-container img {width:100%;} +#slideshow-wrap .slides-wrap {float:right;} +#slideshow-wrap .slides-wrap ul {list-style-type: none; margin: 0; padding: 0; width:210px;} +#slideshow-wrap li {margin:0 10px 10px 0; float:left; width:60px;} +#slideshow-wrap li img {width:100%;} + +.picture-slides-fade-container.ng-hide-add, +.picture-slides-fade-container.ng-hide-remove {-webkit-transition:0.5s linear all; transition:0.5s linear all; } +.picture-slides-fade-container.ng-hide { height:0; opacity: 0} \ No newline at end of file diff --git a/example/angular-simple-slideshow.js b/example/angular-simple-slideshow.js new file mode 100644 index 0000000..d1e3663 --- /dev/null +++ b/example/angular-simple-slideshow.js @@ -0,0 +1,70 @@ +var SlideShow = angular.module('simple-slideshow', ['template/slideshow.html', 'template/slide.html']); + +SlideShow.directive('slideshow', function(){ + return { + scope: { + + }, + controller: function($scope, $element, $attrs, $transclude) { + var ctrl = this, + slides = ctrl.slides = $scope.slides = []; + + ctrl.addSlide = function addSlide(slide){ + slides.push(slide); + }; + + ctrl.select = function(slide){ + $scope.currentslide = slide; + }; + }, + controllerAs: 'slideshowCtrl', + restrict: 'AE', + templateUrl: 'template/slideshow.html', + transclude: true, + link: function($scope, iElm, tAttrs){ + + } + }; +}); + +SlideShow.directive('slide', ['$parse', function($parse){ + return { + require: '^slideshow', + restrict: 'AE', + templateUrl: 'template/slide.html', + transclude: true, + replace: true, + compile: function(elm, attrs, transclude){ + return { + pre: function preLink(scope, elm, attrs, slideshowCtrl){ + elm.on('click', function(elm){ + scope.$apply(scope.select(scope.slide)); + }); + scope.select = function(slide){ + slideshowCtrl.select(slide); + }; + + slideshowCtrl.addSlide(scope.slide); + }, + post: function postLink(scope, elm, attrs, slideshowCtrl){ + slideshowCtrl.select(slideshowCtrl.slides[0]); + } + }; + } + }; +}]); + +angular.module("template/slideshow.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/slideshow.html", + '
' + + '
{{currentslide.name}}

{{currentslide.name}}

' + + '
' + + '
' + ); +}]); + +angular.module("template/slide.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/slide.html", + '
  • ' + ); +}]); \ No newline at end of file diff --git a/example/example-app.js b/example/example-app.js new file mode 100644 index 0000000..2310bd5 --- /dev/null +++ b/example/example-app.js @@ -0,0 +1,6 @@ +angular.module('slideShowExample', ['simple-slideshow']) + .controller('slideShowCtrl', ['$scope', function($scope){ + $scope.slides = [ + {name: 'Not my cat.', url: 'https://farm2.staticflickr.com/1318/5114665665_e55b2c2169_n.jpg'}, + {name: 'Again, not my cat.', url: 'https://farm2.staticflickr.com/1079/901626554_8bc51ec160_n.jpg'}] + }]); \ No newline at end of file diff --git a/example/slideshow-example.html b/example/slideshow-example.html new file mode 100644 index 0000000..5fe6bd9 --- /dev/null +++ b/example/slideshow-example.html @@ -0,0 +1,20 @@ + + + + + + Angular.js Simple Slideshow + + + +
    + + + +
    + + + + + + \ No newline at end of file