diff options
| author | unknown | 2014-03-24 13:32:48 -0300 | 
|---|---|---|
| committer | unknown | 2014-03-24 13:32:48 -0300 | 
| commit | 71a6f3d53961a3dd3164613cdb515321addc9b87 (patch) | |
| tree | 601268ccea2efb4b3f16f683a1936d75624642c3 | |
| parent | ba8432dc198541bef6fb253e97146f52505e780b (diff) | |
| download | nsPopover-71a6f3d53961a3dd3164613cdb515321addc9b87.tar.bz2 | |
This fixes issue #30.5.8
| -rw-r--r-- | bower.json | 2 | ||||
| -rw-r--r-- | example/index.css | 6 | ||||
| -rw-r--r-- | example/index.html | 1 | ||||
| -rw-r--r-- | example/nsPopover.js | 23 | ||||
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/nsPopover.js | 23 | 
6 files changed, 45 insertions, 12 deletions
| @@ -1,6 +1,6 @@  {    "name": "nsPopover", -  "version": "0.5.7", +  "version": "0.5.8",    "homepage": "https://github.com/nohros/nsPopover",    "description": "Popover for angularjs library",    "authors": [ diff --git a/example/index.css b/example/index.css index d641f03..58add65 100644 --- a/example/index.css +++ b/example/index.css @@ -37,11 +37,11 @@ body > section {  article {
    position: relative;
    margin: 0 auto;
 -  float: left;
  }
 -article:after {
 -  clear: both;
 +article + h1 {
 +  clear: left;
 +  display: block;
  }
  h1 {
 diff --git a/example/index.html b/example/index.html index 28ff4fe..034f630 100644 --- a/example/index.html +++ b/example/index.html @@ -77,6 +77,5 @@      </a>
    </article>
  </section>
 -
  </body>
  </html>
\ No newline at end of file diff --git a/example/nsPopover.js b/example/nsPopover.js index 505fbba..b3c9ab5 100644 --- a/example/nsPopover.js +++ b/example/nsPopover.js @@ -5,6 +5,8 @@    var $el = angular.element;
    var isDef = angular.isDefined;
    var forEach = angular.forEach;
 +  var $popovers = [];
 +  var globalId = 0;
    module.directive('nsPopover', function($timeout, $templateCache, $q, $http, $compile, $document) {
      return {
 @@ -54,11 +56,15 @@            $container = $document.find('body');
          }
 -        var $popover = $el('<div></div>');
          var $triangle;
          var placement_;
          var align_;
 +        globalId += 1;
 +
 +        var $popover = $el('<div id="nspopover-' + globalId +'"></div>');
 +        $popovers.push($popover);
 +
          var match = options.placement
            .match(/^(top|bottom|left|right)$|((top|bottom)\|(center|left|right)+)|((left|right)\|(center|top|bottom)+)/);
 @@ -222,8 +228,19 @@            var x = (isDef(w.pageXOffset)) ? w.pageXOffset : doc.scrollLeft;
            var y = (isDef(w.pageYOffset)) ? w.pageYOffset : doc.scrollTop;
            var rect = elm.getBoundingClientRect();
 -          rect.top += y;
 -          rect.left += x;
 +
 +          // ClientRect class is immutable, so we need to return a modified copy
 +          // of it when the window has been scrolled.
 +          if (x || y) {
 +            return {
 +              bottom:rect.bottom+y,
 +              left:rect.left + x,
 +              right:rect.right + x,
 +              top:rect.top + y,
 +              height:rect.height,
 +              width:rect.width
 +            };
 +          }
            return rect;
          }
 diff --git a/package.json b/package.json index fa49190..5459cbe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@  {    "author": "Neylor Ohmaly",    "name": "nsPopover", -  "version": "0.5.7", +  "version": "0.5.8",    "homepage": "http://nohros.com/nsPopover",    "licenses": {      "type": "MIT", diff --git a/src/nsPopover.js b/src/nsPopover.js index 505fbba..b3c9ab5 100644 --- a/src/nsPopover.js +++ b/src/nsPopover.js @@ -5,6 +5,8 @@    var $el = angular.element;
    var isDef = angular.isDefined;
    var forEach = angular.forEach;
 +  var $popovers = [];
 +  var globalId = 0;
    module.directive('nsPopover', function($timeout, $templateCache, $q, $http, $compile, $document) {
      return {
 @@ -54,11 +56,15 @@            $container = $document.find('body');
          }
 -        var $popover = $el('<div></div>');
          var $triangle;
          var placement_;
          var align_;
 +        globalId += 1;
 +
 +        var $popover = $el('<div id="nspopover-' + globalId +'"></div>');
 +        $popovers.push($popover);
 +
          var match = options.placement
            .match(/^(top|bottom|left|right)$|((top|bottom)\|(center|left|right)+)|((left|right)\|(center|top|bottom)+)/);
 @@ -222,8 +228,19 @@            var x = (isDef(w.pageXOffset)) ? w.pageXOffset : doc.scrollLeft;
            var y = (isDef(w.pageYOffset)) ? w.pageYOffset : doc.scrollTop;
            var rect = elm.getBoundingClientRect();
 -          rect.top += y;
 -          rect.left += x;
 +
 +          // ClientRect class is immutable, so we need to return a modified copy
 +          // of it when the window has been scrolled.
 +          if (x || y) {
 +            return {
 +              bottom:rect.bottom+y,
 +              left:rect.left + x,
 +              right:rect.right + x,
 +              top:rect.top + y,
 +              height:rect.height,
 +              width:rect.width
 +            };
 +          }
            return rect;
          }
 | 
