Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed positioning to be relative #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('./massautocomplete');
module.exports = 'MassAutoComplete';
13 changes: 5 additions & 8 deletions massautocomplete.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global angular */
(function() {
'use strict';
(function(angular) {'use strict';

angular.module('MassAutoComplete', [])

Expand Down Expand Up @@ -34,12 +33,10 @@ angular.module('MassAutoComplete', [])

// Position ac container given a target element
config.position_autocomplete = function(container, target) {
var rect = target[0].getBoundingClientRect(),
scrollTop = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset,
scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft || window.pageXOffset;
var rect = target[0].getBoundingClientRect();

container[0].style.top = rect.top + rect.height + scrollTop + 'px';
container[0].style.left = rect.left + scrollLeft + 'px';
container[0].style.top = rect.height + 'px';
container[0].style.left = 0;
container[0].style.width = rect.width + 'px';
};

Expand Down Expand Up @@ -458,4 +455,4 @@ angular.module('MassAutoComplete', [])
}
};
});
})();
})(window.angular);
2 changes: 1 addition & 1 deletion massautocomplete.min.js

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

5 changes: 4 additions & 1 deletion massautocomplete.theme.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[mass-autocomplete] {
position: relative;
}
.ac-container {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
Expand Down Expand Up @@ -39,4 +42,4 @@
.ac-container .ac-menu .ac-state-focus {
outline: none;
background-color: #e0eaff;
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "angular-mass-autocomplete",
"version": "0.5.0",
"version": "0.5.4",
"description": "Autocomplete for Angular.js applications with a lot to complete",
"main": "massautocomplete.js",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/hakib/MassAutocomplete"
Expand All @@ -18,8 +18,8 @@
"bugs": {
"url": "https://github.com/hakib/MassAutocomplete/issues"
},
"peerDependencies": {
"angular": "1"
"dependencies": {
"angular": "*"
},
"devDependencies": {
"eslint": "^3.1.1",
Expand Down