Skip to content

Commit

Permalink
Included pull Pixabay#6 and added offsetLeft/offsetTop as optional pa…
Browse files Browse the repository at this point in the history
…rameter for suggestions container.
  • Loading branch information
SimonSteinberger committed Feb 10, 2016
1 parent 478e4dd commit eda3201
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
10 changes: 6 additions & 4 deletions auto-complete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
JavaScript autoComplete v1.0.3
JavaScript autoComplete v1.0.4
Copyright (c) 2014 Simon Steinberger / Pixabay
GitHub: https://github.com/Pixabay/JavaScript-autoComplete
License: http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -33,6 +33,8 @@ var autoComplete = (function(){
source: 0,
minChars: 3,
delay: 150,
offsetLeft: 0,
offsetTop: 1,
cache: 1,
menuClass: '',
renderItem: function (item, search){
Expand Down Expand Up @@ -61,9 +63,9 @@ var autoComplete = (function(){

that.updateSC = function(resize, next){
var rect = that.getBoundingClientRect();
that.sc.style.left = rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + 'px';
that.sc.style.top = rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + 1 + 'px';
that.sc.style.width = rect.right - rect.left + 'px'; // outerWidth
that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
if (!resize) {
that.sc.style.display = 'block';
if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }
Expand Down
4 changes: 2 additions & 2 deletions auto-complete.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 bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "javascript-auto-complete",
"description": "An extremely lightweight vanilla JavaScript completion suggester.",
"version": "1.0.3",
"version": "1.0.4",
"homepage": "https://github.com/Pixabay/JavaScript-autoComplete",
"authors": [{
"name": "Simon Steinberger",
Expand Down
2 changes: 2 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ <h3>Settings</h3>
</td></tr>
<tr><td>minChars</td><td>3</td><td>Minimum number of characters (>=1) a user must type before a search is performed.</td></tr>
<tr><td>delay</td><td>150</td><td>The delay in milliseconds between when a keystroke occurs and when a search is performed. A zero-delay is more responsive, but can produce a lot of load.</td></tr>
<tr><td>offsetLeft</td><td><i>0</i></td><td>Optional left offset of the suggestions container.</td></tr>
<tr><td>offsetTop</td><td><i>1</i></td><td>Optional top offset of the suggestions container.</td></tr>
<tr><td>cache</td><td><i>true</i></td><td>Determines if performed searches should be cached.</td></tr>
<tr>
<td>menuClass</td><td><i>''</i></td>
Expand Down
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ https://goodies.pixabay.com/javascript/auto-complete/demo.html

## Changelog

### Version 1.0.4 - 2016/02/10

* Included pull #6 and added offsetLeft/offsetTop as optional parameter for suggestions container.


### Version 1.0.3 - 2015/11/02

* Fixed #2: Unspecified error on IE 10.
Expand Down

0 comments on commit eda3201

Please sign in to comment.