Skip to content

Commit

Permalink
Wrap content into divs + more demo examples
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRusskiy committed Mar 18, 2016
1 parent 845f7e0 commit dae8506
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 13 deletions.
39 changes: 36 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,43 @@
<link rel="stylesheet" href="style.css"/>
</head>
<body ng-controller="MyCtrl" ng-cloak>
<div ng-click="widgetExpandedLazy = !widgetExpandedLazy" class="head">
Lazy, initial false
</div>
<div ng-slide-down="widgetExpandedLazy" lazy-render duration="1">
<div class="content">
Some awesome content here
</div>
</div>
<div class="footer">
After content
</div>
<div ng-click="widgetExpanded = !widgetExpanded" class="head">
Click to slide in/out
Non lazy, initial false
</div>
<div ng-slide-down="widgetExpanded" duration="1">
<div class="content">
Some awesome content here
</div>
</div>
<div class="footer">
After content
</div>
<div ng-init="widgetExpandedLazyTrue = true" ng-click="widgetExpandedLazyTrue = !widgetExpandedLazyTrue" class="head">
Lazy, initial true
</div>
<div ng-slide-down="widgetExpandedLazyTrue" lazy-render duration="1">
<div class="content">
Some awesome content here
</div>
</div>
<div class="footer">
After content
</div>
<div ng-init="widgetExpandedTrue = true" ng-click="widgetExpandedTrue = !widgetExpandedTrue" class="head">
Non lazy, initial true
</div>
<div ng-slide-down="widgetExpanded" lazy-render duration="1">
<div ng-slide-down="widgetExpandedTrue" duration="1">
<div class="content">
Some awesome content here
</div>
Expand All @@ -21,4 +54,4 @@
After content
</div>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions demo/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
var getTemplate, link;
getTemplate = function (tElement, tAttrs) {
if (tAttrs.lazyRender !== void 0) {
return '<div ng-if=\'lazyRender\' ng-transclude></div>';
return '<div><div ng-transclude ng-if=\'lazyRender\'></div></div>';
} else {
return '<div ng-transclude></div>';
return '<div><div ng-transclude></div></div>';
}
};
link = function (scope, element, attrs, ctrl, transclude) {
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-slide-down.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
var getTemplate, link;
getTemplate = function (tElement, tAttrs) {
if (tAttrs.lazyRender !== void 0) {
return '<div ng-if=\'lazyRender\' ng-transclude></div>';
return '<div><div ng-transclude ng-if=\'lazyRender\'></div></div>';
} else {
return '<div ng-transclude></div>';
return '<div><div ng-transclude></div></div>';
}
};
link = function (scope, element, attrs, ctrl, transclude) {
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-slide-down.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-slide-down",
"version": "0.4.2",
"version": "1.0.0",
"description": "Slider animation directive for AngularJS",
"homepage": "https://github.com/TheRusskiy/ng-slide-down",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/ng-slide-down.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
getTemplate = (tElement, tAttrs)->
if tAttrs.lazyRender != undefined
"<div ng-if='lazyRender' ng-transclude></div>"
"<div><div ng-transclude ng-if='lazyRender'></div></div>"
else
"<div ng-transclude></div>"
"<div><div ng-transclude></div></div>"

link = (scope, element, attrs, ctrl, transclude) ->
duration = attrs.duration || 1
Expand Down Expand Up @@ -79,4 +79,4 @@ angular.module("ng-slide-down", []).directive "ngSlideDown", ($timeout )->
transclude: true
link: link
template: (tElement, tAttrs)-> getTemplate(tElement, tAttrs)
}
}

0 comments on commit dae8506

Please sign in to comment.