Skip to content

Commit

Permalink
Initial implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceilino committed May 29, 2015
0 parents commit c8cd3bd
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tmp/
37 changes: 37 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "angular-ez-plus",
"version": "1.0.0",
"author": {
"name": "Igor Lino",
"url": "http://igorlino.github.io/angular-angular-elevatezoom-plus/"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
],
"main": [
"js/widget-ezplus-directive.js",
"images/loader-small.gif"
],
"ignore": [
"**/.*",
"node_modules",
"components"
],
"bugs": "https://github.com/igorlino/angular-elevatezoom-plus/issues",
"homepage": "http://igorlino.github.io/angular-elevatezoom-plus/",
"docs" : "http://igorlino.github.io/angular-elevatezoom-plus/examples",
"demo" : "http://igorlino.github.io/angular-elevatezoom-plus/examples",
"dependencies": {
"jquery": "~2.1.1",
"angular": "~1.3.4"
},
"devDependencies": {
},
"resolutions": {
"jquery": "~2.1.1",
"angular": "~1.3.4"
}
}
Binary file added images/loader-small.GIF
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions js/widget-ezplus-directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
(function () {
'use strict';

angular.module('ezplus')
.directive('ezPlus', ezPlus);

function ezPlus() {
var service = {
restrict: 'A',
scope: {
ngModel: '='
},
link: link
};
return service;

////////////////////////////


link.$inject = ['scope', 'element'];
function link(scope, element) {
scope.$watch('ngModel', function (image) {
var thumbMediumUrl = (image && image.thumbMediumUrl) || '';
var fullSizeUrl = (image && image.fullSizeUrl) || '';

var plugin = angular.element(element).data('ezPlus');
if (plugin) {
var loader = 'images/loader-small.gif';
plugin.swaptheimage(loader, loader);
plugin.swaptheimage(thumbMediumUrl, fullSizeUrl);
} else if (image) {
element.attr('src', thumbMediumUrl);
element.attr('data-zoom-image', fullSizeUrl);
angular.element(element).elevateZoom({
scrollZoom: true,
zoomWindowWidth: 600,
zoomWindowHeight: 600,
easing : true,
zoomWindowFadeIn: 500,
zoomWindowFadeOut: 500,
lensFadeIn: 500,
lensFadeOut: 500
});
}
});

scope.$on('$destroy', function () {
element.remove();
});
}
}

})
();

0 comments on commit c8cd3bd

Please sign in to comment.