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

[Question] Using the hexagrid in a div #23

Closed
MinThaMie opened this issue Aug 9, 2017 · 9 comments
Closed

[Question] Using the hexagrid in a div #23

MinThaMie opened this issue Aug 9, 2017 · 9 comments

Comments

@MinThaMie
Copy link

MinThaMie commented Aug 9, 2017

I'm using your grid as follows:

<div id="honeycomb"><ul id="hexGrid"></ul></div>

and then dynamically append the list items with jquery like this: $("#hexGrid").append('<li class="hex"><a class="hexIn" href="#"><img src=' + data[i].photo + ' alt="" />' + '<h1>' + data[i].employee_id + '</h1><p></p></a></li>');

And even though the parent div is larger the hexGrid does not stretch as nicely as in your examples. I did not change any code and took the code from this codepen: https://codepen.io/web-tiki/pen/wWGeEM

Hopefully one of you can help me to figure this out, because it looks not so nice now :(
screen shot 2017-08-09 at 16 42 08

@poi33
Copy link
Collaborator

poi33 commented Aug 9, 2017

I created this example: https://jsfiddle.net/w1o7kzow/2/
And there does not seem to be anything wrong with the code.
Maybe there is some css that affects the "honeycomb" id?

@web-tiki
Copy link
Owner

web-tiki commented Aug 10, 2017

@MinThaMie the behaviour you see is the normal behaviour. If you stretch width of the result window in the codepen, you will see that the grid adjusts to 2-3 hexagons per row. As you only have 4, and the fifth one is missing, it looks like the grid isn't centered.

I suppose (you haven't explained what you want) that you want the grid to always display 1-2 hexagons per row. For this, you just need to modify the CSS:

  • move the content of the second media query out of it (@media (max-width: 1200px) { /* <- 4-3 hexagons per row */)
  • delete the second media query with all it's content (@media (min-width:1201px) { /* <- 2-3 hexagons per row */)

@MinThaMie
Copy link
Author

MinThaMie commented Aug 10, 2017

Thanks for the answers, for some reason the extra div broke the height of the <ul>. Thanks for the quick response :) I love this repo!

@web-tiki
Copy link
Owner

On a side note, you should use the CSS from the repo rather than the one on Codepen as it isn't maintained there.

@MinThaMie
Copy link
Author

MinThaMie commented Aug 10, 2017

The repo CSS results in this:
screen shot 2017-08-10 at 11 31 16

In safari and firefox

@MinThaMie MinThaMie reopened this Aug 10, 2017
@poi33
Copy link
Collaborator

poi33 commented Aug 10, 2017

@web-tiki did we ever test the grid in safari?
Are there some -prefixes we are missing?

@web-tiki
Copy link
Owner

@poi33 the grid has been successfully tested on safari and firefox and no prefixes are missing.
@MinThaMie have you tested the repo demo here? And what versions on firefox and safari have you seen that result on?

@MinThaMie
Copy link
Author

I'm really sorry. I managed to forget one crucial class :(

@web-tiki
Copy link
Owner

No problem.

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

3 participants