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

CSS #111

Open
ghost opened this issue Oct 29, 2015 · 7 comments
Open

CSS #111

ghost opened this issue Oct 29, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 29, 2015

How can I edit the CSS? It keeps closing when viewing on chrome console.

@taylorwc
Copy link

taylorwc commented Feb 9, 2016

The default styles are set in one of the js files for the package. For example, in your local directory, check out .meteor > local > build > programs > web.browser > packages > mizzao_autocomplete.js ... then look at the positionContainer function starting at line 487:

AutoComplete.prototype.positionContainer = function() {                                                   // 449
    var offset, pos, position, rule;                                                                        // 450
    position = this.$element.position();                                                                    // 451
    rule = this.matchedRule();                                                                              // 452
    offset = getCaretCoordinates(this.element, this.element.selectionStart);                                // 453
    if ((rule != null) && isWholeField(rule)) {                                                             // 454
      pos = {                                                                                               // 455
        left: position.left,                                                                                // 456
        width: this.$element.outerWidth()                                                                   // 457
      };                                                                                                    // 458
    } else {                                                                                                // 459
      pos = {                                                                                               // 460
        left: position.left + offset.left                                                                   // 461
      };                                                                                                    // 462
    }                                                                                                       // 463
    if (this.position === "top") {                                                                          // 464
      pos.bottom = this.$element.offsetParent().height() - position.top - offset.top;                       // 465
    } else {                                                                                                // 466
      pos.top = position.top + offset.top + parseInt(this.$element.css('font-size'));                       // 467
    }                                                                                                       // 468
    return this.tmplInst.$(".-autocomplete-container").css(pos);                                            // 469
  };              

That said, the simplest thing is probably to create an override in the appropriate CSS file in your meteor app. For example, you can edit the entire container with a rule for the class .-autocomplete-container.

@aviemet
Copy link

aviemet commented Jul 4, 2016

I'm a little confused about the position "bottom" offset choices. This displays the results directly under the text in the input field, not directly under the input field. It looks very strange. Instead of adding the font-size to the offset, shouldn't it add the height of the input? Is there a use case where the input triggering the results wouldn't be an input field?

screenshot from 2016-07-04 14 28 16

@micktaiwan
Copy link

micktaiwan commented Apr 12, 2017

Someone fixed the pb described just above?

@avram-battery
Copy link

Bumping an old thread, it seems this issue hasn't been addressed yet.

Would really like the ability to specify whether the results will be aligned to the text or to the input box. Perhaps there could be a setting in rules like alignToInput which defaults to false.

@ddaydd
Copy link

ddaydd commented Aug 3, 2017

this is my solution you can try...

.-autocomplete-container {
  margin-top: 20px;
  margin-left: 5px;
  .searchResult {
    padding: 2px;
  }
}

@avram-battery
Copy link

I did override the css to nudge the results down a little, but I still think there is value in integrating this behavior. A margin of 20px may work for your styling, but it's not universal. I think it would be trivial to add this as an option, I may put in the work myself if I have some free time.

@mizzao
Copy link
Collaborator

mizzao commented Aug 3, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants