Answer the question
In order to leave comments, you need to log in
How to make AngularJS and jQuery Justified Gallery friends?
All the best. I'm trying to use the Justified Gallery
jQuery library
. In the controller, I create an array with links to images. Further , according to this decision, I build the structure.
The result is this picture:
Template
<div justified id="justified">
<a ng-repeat="image in imagesInView track by $index" ng-href="#" repeat-done>
<img ng-src="{{image}}"/>
</a>
</div>
angular.module('myApp')
.directive('repeatDone', [function() {
return {
restrict: 'A',
link: function(scope, element, iAttrs) {
var parentScope = element.parent().scope();
if (scope.$last) {
parentScope.$last = true;
}
}
};
}]);
angular.module('myApp')
.directive('justified', [
function() {
return {
restrict: 'A',
link: function(scope, el, attrs) {
scope.$watch('$last', function(n, o) {
if (n) {
angular.element("#justified").justifiedGallery({
rowHeight: 300
});
}
});
}
};
}]);
.on('jg.complete', function(){
//recalc для избежания вечного цикла
if (!recalc) {
angular.element("#justified").justifiedGallery('norewind');
recalc = true
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question