Last active
July 11, 2016 12:34
-
-
Save vishalbasnet23/4591d93b25033c88e39b3274aaf32f48 to your computer and use it in GitHub Desktop.
3D Carousel Directive For Angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('myApp') | |
.directive( '3dcarousel', ['$timeout', function($timeout) { | |
return{ | |
link: function($scope, element, attrs) { | |
$scope.$on('sliderLoaded', function() { | |
$timeout(function() { | |
var actualWidth = angular.element( window ).width() | |
var documentWidth = actualWidth * 0.464 ; | |
var documentHeight = documentWidth * 0.7; | |
element.carousel({ | |
frontWidth: documentWidth, | |
frontHeight: documentHeight, | |
carouselWidth: actualWidth, | |
carouselHeight: documentHeight, | |
directionNav:true, | |
description: true, | |
descriptionContainer: '.description', | |
}); | |
}, 0, false); | |
}) | |
} | |
} | |
}]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div 3dcarousel class="slider-wrapper"> | |
<div class="slides"> <!-- BEGIN CAROUSEL --> | |
<div class="slideItem" ng-repeat="slide in slides" ng-class="{'active-slide':$first}"> <!-- SLIDE ITEM --> | |
<img ng-src="{{slide.featured_image_thumbnail_url.full}}"> | |
<div class="description"> | |
<ul> | |
<li> | |
<span class="product-name">Net Rod MKii</span> | |
<span class="product-cat">Fibreglass & Cork</span> | |
</li> | |
<li><a href="#" class="btn line light">order this product <i class="icon-arrow"></i> </a></li> | |
</ul> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.controller('slideCtrl', function ($scope, $timeout) { | |
$scope.slides = ['imagepath-1', 'image-path-2']; | |
$scope.setCarouselSlides = function() { | |
$scope.$broadcast('sliderLoaded'); | |
}; | |
$scope.setCarouselSlides(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment