Created
September 11, 2014 21:21
-
-
Save dflatley/82114f5d9a6ce1315e58 to your computer and use it in GitHub Desktop.
AngularJS Directive for ShapeShift.js plugin
This file contains 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('shapeshiftapp.controllers', []) | |
.directive('shapeshift', function () { | |
return { | |
restrict: "A", | |
link: function (scope, element, attrs) { | |
// init shapeshift with no attributes | |
//$(element).shapeshift(scope.$eval(attrs.shapeshift)); | |
// init shapeshift with any/all attributes | |
var shapeshiftcontainer = element.shapeshift({ | |
enableDrag: true, | |
enableCrossDrop: true, | |
minColumns: 2, | |
animated: true, | |
animateOnInit: false, | |
animationSpeed: 225, | |
animationThreshold: 100, | |
colWidth: 80, | |
align: "left", | |
dragClone: false, | |
deleteClone: true, | |
maxHeight: null, | |
minHeight: 400 | |
}); | |
// handler for added draggable item | |
shapeshiftcontainer.on( "ss-added", function(e, selected) | |
{ | |
//console.log(selected); | |
}); | |
} | |
}; | |
}) | |
.controller('FrontCtrl', function($scope) { | |
console.log("controller..."); | |
}); |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>AngularJS ShapeShift.js Directive</title> | |
<link href="app/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" type="text/css" /> | |
<script src="app/js/jquery-1.10.2.min.js"></script> | |
<script src="app/js/jquery-ui-1.9.2.custom.js"></script> | |
<script src="app/js/angular.min.js"></script> | |
<script src="app/js/jquery.shapeshift.js"></script> | |
<script src="app/app.js"></script> | |
<script src="app/controllers/controllers.js"></script> | |
<style> | |
.container { | |
border: 1px dashed #ccc; | |
position: relative; | |
} | |
.container > div { | |
background: #CCC; | |
height: 100px; | |
position: absolute; | |
width: 80px; | |
} | |
.container > div[data-ss-colspan='2'] { width: 170px; } | |
.container .ss-placeholder-child { | |
background: transparent; | |
border: 1px dashed red; | |
} | |
</style> | |
</head> | |
<body ng-app="shapeshiftapp" ng-controller="FrontCtrl"> | |
<h1>AngularJS Directive for a ShapeShift.js plugin</h1> | |
<div class="container" shapeshift > | |
<div></div> | |
<div></div> | |
<div data-ss-colspan='2'></div> | |
<div></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment