Skip to content

Commit

Permalink
Added showAll, hidesAll, enableZoom, disableZoom events for the direc…
Browse files Browse the repository at this point in the history
…tive.

Added appendTo option for directive.
Update ez-plus 3rd party version.
  • Loading branch information
ceilino committed Jun 2, 2015
1 parent d1d1bf1 commit 37d18aa
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 22 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ez-plus",
"version": "1.0.4",
"version": "1.0.5",
"author": {
"name": "Igor Lino",
"url": "http://igorlino.github.io/angular-elevatezoom-plus/"
Expand Down Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"jquery": "~2.1.1",
"angular": "~1.3.4",
"ez-plus": "~1.1.1"
"ez-plus": "~1.1.3"
},
"devDependencies": {
},
Expand Down
79 changes: 60 additions & 19 deletions js/ezplus.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,72 @@

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


link.$inject = ['scope', 'element'];
function link(scope, element) {

link.$inject = ['scope', 'element'];
function link(scope, element, attrs) {
scope.appendto = typeof(attrs.appendto) !== 'undefined' ? attrs.appendto : null;

scope.$on("ezp-hidesAll", function (e, msg) {
var plugin = angular.element(element).data('ezPlus');
if (plugin) {
plugin.showHideWindow('hide');
plugin.showHideTint('hide');
plugin.showHideLens('hide');
}
});
scope.$on("ezp-showAll", function (e, msg) {
var plugin = angular.element(element).data('ezPlus');
if (plugin) {
plugin.showHideWindow('show');
plugin.showHideTint('show');
plugin.showHideLens('show');
}
});
scope.$on("ezp-disableZoom", function (e, msg) {
var plugin = angular.element(element).data('ezPlus');
if (plugin) {
plugin.changeState('disable');
}
});
scope.$on("ezp-enableZoom", function (e, msg) {
var plugin = angular.element(element).data('ezPlus');
if (plugin) {
plugin.changeState('enable');
}
});
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).ezPlus({
scrollZoom: true,
zoomWindowWidth: 600,
zoomWindowHeight: 600,
easing : true,
zoomWindowFadeIn: 500,
zoomWindowFadeOut: 500,
lensFadeIn: 500,
lensFadeOut: 500
});
if (image) {
var loader = 'images/loader-small.gif';
plugin.showHideWindow();
plugin.swaptheimage(loader, loader);
plugin.swaptheimage(thumbMediumUrl, fullSizeUrl);
} else {
plugin.closeAll();
}
} else {
if (image) {
element.attr('src', thumbMediumUrl);
element.attr('data-zoom-image', fullSizeUrl);
var options = {
scrollZoom: true,
zoomWindowWidth: 600,
zoomWindowHeight: 600,
easing: true,
zoomWindowFadeIn: 500,
zoomWindowFadeOut: 500,
lensFadeIn: 500,
lensFadeOut: 500
};
if (scope.appendto) {
options.zoomContainerAppendTo = scope.appendto;
}
angular.element(element).ezPlus(options);
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ez-plus",
"version": "1.0.4",
"version": "1.0.5",
"title": "Angular EZ Plus",
"description": "Angular directive for ElevateZoom Plus.",
"keywords": [
Expand Down

0 comments on commit 37d18aa

Please sign in to comment.