Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <a href="myimage.jpg" rel="shadowbox">image name</a>
  2.  
  3. <a ng-repeat="pic in pics" href="{{pic}}" rel="shadowbox">image name</a>
  4.  
  5. angular.module('yourModuleName') // you can use your own name here
  6. .directive('shadowbox', function() {
  7. return {
  8. // here you can style the link/thumbnail/etc.
  9. template: '<a ng-click="openShadowbox()">{{imageName}}</a>',
  10. scope: {
  11. imageName: '@name',
  12. imageUrl: '@url'
  13. },
  14. link: function (scope, element, attrs) {
  15.  
  16. // the function that is called from the template:
  17. scope.openShadowbox = function () {
  18.  
  19. // see Shadowbox documentation on what to write here.
  20. // Example from the documentation:
  21.  
  22. Shadowbox.open({
  23. content: '<div id="welcome-msg">Welcome to my website!</div>',
  24. player: "html",
  25. title: "Welcome",
  26. height: 350,
  27. width: 350
  28. });
  29. };
  30.  
  31. }
  32. };
  33. });
  34.  
  35. <a shadowbox name="image name" url="image url"></a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement