GithubHelp home page GithubHelp logo

stowball / eqio Goto Github PK

View Code? Open in Web Editor NEW
429.0 9.0 11.0 1.17 MB

A simple, tiny alternative to element/container queries

Home Page: https://codepen.io/stowball/pen/zPYzWd

License: MIT License

JavaScript 100.00%
javascript css responsive-design element-queries container-queries media-queries

eqio's Issues

Resizing container width via CSS or Script messes with the eqio classes

I have something like this:

<div class='prl-interface eqio' data-eqio-sizes='["<545.98", "<737.98", "<961.98", "<1169.98", ">546", ">738", ">962", ">1170"]' data-eqio-prefix='prl'>

And have CSS classes like these:

.prl-eqio-\<961\.98, .prl-eqio-\<1169\.98, .prl-eqio-\>962 etc

this does work fine when resizing the browser window so if I end up resizing to width 1000px I get:

<div class='prl-interface eqio prl-eqio->546 prl-eqio->738 prl-eqio-<1169.98 prl-eqio->962' data-eqio-sizes='["<545.98", "<737.98", "<961.98", "<1169.98", ">546", ">738", ">962", ">1170"]' data-eqio-prefix='prl'>

But if I resize using a Script or CSS where let's say I add a right margin of 230px to a 1230px width container to get the same 1000px I get:

<div class='prl-interface eqio prl-eqio-<1169.98' data-eqio-sizes='["<545.98", "<737.98", "<961.98", "<1169.98", ">546", ">738", ">962", ">1170"]' data-eqio-prefix='prl'>

So most of the classes are not added and I lose the styles I could've added on the prl-eqio->962 class for example.
The worst part is that as it could add prl-eqio-<1169.98, it could add prl-eqio->962 instead, making it totally random and unpredictable.

What can I do in this case to fix it?

thanks in advance.

eqio__trigger elements create horizontal scrollbars

Hi Matt,

I really like the simple approach to have something like container/element queries. While trying to adapt your approach to an Angular directive I realized that the trigger elements (.eqio__trigger) generate a horizontal scrollbar when the width doesn't fit into viewport anymore. As this element may only be visually hidden to make the IntersectionObserver working, the whole idea seems to be limited to some use cases.

eqio

Did you use eqio yourself in mobile first projects to build components that self adapt to their parents width?

Thanks,
Markus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.