From 426617e292db2584cdfc16be8462236f0b3d8a87 Mon Sep 17 00:00:00 2001 From: Neylor Ohmaly Date: Wed, 5 Feb 2014 17:24:56 -0200 Subject: Improved the README.md text. --- example/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'example/index.js') diff --git a/example/index.js b/example/index.js index 6315168..c742c1e 100644 --- a/example/index.js +++ b/example/index.js @@ -1,5 +1,6 @@ angular .module('nsPopoverExample', ['nsPopover']) + .controller('MainCtrl', function($scope) { $scope.items = [{ name: "Action" @@ -8,4 +9,24 @@ angular }, { name: "Something else here" }]; + }) + + .directive('viewportWidth', function() { + return { + link: function(scope, elm, attrs) { + function getViewport() { + var e = window, a = 'inner'; + if (!('innerWidth' in window)) { + a = 'client'; + e = document.documentElement || document.body; + } + return { + width : e[a + 'Width'] , + height : e[a + 'Height'] + }; + } + + elm.css('maxWidth', getViewport().width + 'px'); + } + }; }); \ No newline at end of file -- cgit v1.2.3