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

Any way to move the icon to the left? #50

Closed
TennoSerra opened this issue Sep 2, 2022 · 2 comments
Closed

Any way to move the icon to the left? #50

TennoSerra opened this issue Sep 2, 2022 · 2 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@TennoSerra
Copy link

TennoSerra commented Sep 2, 2022

Its working great! I just want to move the icon to the left.
image
I tried using ::before instead of ::after. I doesnt seem to work like that.
Other than that It could be done with using flexbox to move it around. But then I would have to make the icon an img tag
This breaks the changing icon when opened or closed.
image
image

This is an example of what im doing right now.(I replaced the + and - with Fontawesome Unicode Icons)
Im sorry if this question seems stupid.
Thanks for any help!

@michu2k
Copy link
Owner

michu2k commented Sep 4, 2022

Hi @TennoSerra
To move the icon to the left, you need to change position from right to left and add an additional spacing on the left side of the trigger. Here's a quick example of how you can do it:

HTML:

<button class="ac-trigger ac-trigger-left">....</button>

CSS:

  .ac .ac-trigger-left {
    padding: 10px 10px 10px 30px;
  }

  .ac .ac-trigger-left::after {
    content: "+"; /* FontAwesome icon */
    left: 10px;
    right: auto;
  }

  .ac.is-active > .ac-header .ac-trigger-left::after {
    content: "–";  /* FontAwesome icon */
  }

@michu2k michu2k added question Further information is requested help wanted Extra attention is needed labels Sep 4, 2022
@TennoSerra
Copy link
Author

It worked perfectly mate! Thank you very much for your help.
Your library is great and its really helping people like me who dont really know much JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants