Created
August 14, 2014 13:08
-
-
Save tlimpanont/122f2745e595935200df to your computer and use it in GitHub Desktop.
angular layout manager including jquery ui
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
| /*================================================================ | |
| => Directive = relativeLayoutContainer | |
| ==================================================================*/ | |
| /*global app*/ | |
| app.directive('relativeLayoutContainer', ['$rootScope', | |
| function($rootScope) { | |
| 'use strict'; | |
| return { | |
| restrict: 'AE', | |
| replace: true, | |
| transclude: true, | |
| template: "<div ng-transclude />", | |
| link: function(scope, element, attrs) { | |
| jQuery(element).css({ | |
| "position": "absolute" | |
| }); | |
| var ofElement = (jQuery(element).parent()[0].tagName.toLowerCase() == 'body') ? window : jQuery(element).parent()[0]; | |
| setTimeout(function() { | |
| init(); | |
| jQuery(window).resize(init); | |
| }, 0); | |
| function init() { | |
| jQuery(element) | |
| .position({ | |
| of: ofElement, | |
| at: attrs.at.toString(), | |
| my: attrs.my.toString(), | |
| collision: "none" | |
| }); | |
| } | |
| } | |
| }; | |
| } | |
| ]); | |
| /*----- End of Directive = relativeLayoutContainer ------*/ |
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
| <relative-layout-container style="width: 500px; height: 500px; background: red;" data-my="center center" data-at="center center"> | |
| <relative-layout-container style="width: 200px; height: 200px; background: green;" data-my="center center" data-at="center center"> | |
| <relative-layout-container style="width: 20px; height: 20px; background: black;" data-my="center center" data-at="right center"> | |
| </relative-layout-container> | |
| <relative-layout-container style="width: 20px; height: 20px; background: blue;" data-my="center center" data-at="left top"> | |
| </relative-layout-container> | |
| </relative-layout-container> | |
| <relative-layout-container style="width: 20px; height: 20px; background: black;" data-my="center center" data-at="right center"> | |
| </relative-layout-container> | |
| </relative-layout-container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment