All Projects → stowball → Eqio

stowball / Eqio

Licence: mit
A simple, tiny alternative to element/container queries

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Eqio

noir
Noir is a modern, responsive and customizable theme for Jekyll with dark mode support.
Stars: ✭ 68 (-84.07%)
Mutual labels:  responsive-design
Java
Java Projects
Stars: ✭ 24 (-94.38%)
Mutual labels:  responsive-design
Hexo Theme Matery
A beautiful hexo blog theme with material design and responsive design.一个基于材料设计和响应式设计而成的全面、美观的Hexo主题。国内访问:http://blinkfox.com
Stars: ✭ 3,907 (+814.99%)
Mutual labels:  responsive-design
science-fiction-magazines-blog
Blog template (concept) is inspired by stylish science fiction magazines of the 80-90s.
Stars: ✭ 24 (-94.38%)
Mutual labels:  responsive-design
magixcms
Magix cms est un gestionnaire de contenu développé en PHP 5, proposant une multitude d'outils intégrés. Le gestionnaire est simple et intuitif permettant une adaptation rapide pour tout utilisateur, ainsi qu'une indexation optimal dans les moteurs de recherches.
Stars: ✭ 16 (-96.25%)
Mutual labels:  responsive-design
brevis
CSS at scale
Stars: ✭ 62 (-85.48%)
Mutual labels:  responsive-design
MVCShoppingMall
Use ASP.NET MVC to build e-commerce platform, including backoffice.
Stars: ✭ 30 (-92.97%)
Mutual labels:  responsive-design
React Native Responsive Grid
Bringing the Web's Responsive Design to React Native
Stars: ✭ 369 (-13.58%)
Mutual labels:  responsive-design
pine
Responsive CSS Framework ( PineCSS )
Stars: ✭ 41 (-90.4%)
Mutual labels:  responsive-design
Hexo Theme Stun
🦄 An elegant theme for Hexo
Stars: ✭ 305 (-28.57%)
Mutual labels:  responsive-design
mviewer
Visualiseur géographique thématique basé sur OpenLayers 6.3.1 et Bootstrap 3.3.6 / cartographic application based on OpenLayers and Bootstrap
Stars: ✭ 53 (-87.59%)
Mutual labels:  responsive-design
webgui
Web Technologies based Crossplatform GUI Framework with Dark theme
Stars: ✭ 81 (-81.03%)
Mutual labels:  responsive-design
Understanding Flexbox
💪Detailed Flexbox Book
Stars: ✭ 286 (-33.02%)
Mutual labels:  responsive-design
responsive-project-landing-page
A responsive landing page for open source projects
Stars: ✭ 24 (-94.38%)
Mutual labels:  responsive-design
Layout
Flutter | Create responsive layouts for mobile, web and desktop
Stars: ✭ 312 (-26.93%)
Mutual labels:  responsive-design
gatsby-starter-krisp
A minimal, clean and responsive starter built with gatsby
Stars: ✭ 14 (-96.72%)
Mutual labels:  responsive-design
Responsive-Navbar-with-Angular-Material-and-Angular-Flex-Layout
Responsive Navbar with Angular Material and Angular Flex Layout
Stars: ✭ 45 (-89.46%)
Mutual labels:  responsive-design
Easybank Learning Sass
I'm learning sass in a live streaming
Stars: ✭ 416 (-2.58%)
Mutual labels:  responsive-design
Breakpoint Slicer
Slice media queries with ease
Stars: ✭ 332 (-22.25%)
Mutual labels:  responsive-design
Scally
Scally is a Sass-based, BEM, OOCSS, responsive-ready, CSS framework that provides you with a solid foundation for building reusable UI's quickly 🕶
Stars: ✭ 294 (-31.15%)
Mutual labels:  responsive-design

eqio logo

eqio

A simple, tiny alternative to element/container queries

eqio allows you to attain the holy grail of responsive web development/design systems: components that can adapt their styling based on their width, not the browser‘s.

It uses IntersectionObservers under-the-hood (so is well supported in “good” browsers and easily polyfilled in others) to apply appropriately named classes to the component when necessary.

Table of Contents

Demo

A complete demo is available here: https://codepen.io/stowball/pen/zPYzWd

Installation

npm

npm install eqio --save

Direct <script> include

<script src="https://unpkg.com/eqio/umd/eqio.min.js"></script>

Usage

The HTML

  1. Add a class of eqio to the element.
  2. Add a data-eqio-sizes attribute whose value is a JSON-serializable array of sizes.
  3. Optionally add a data-eqio-prefix attribute whose value is used as the prefix for your class names.
<div
  class="media-object eqio"
  data-eqio-sizes='["<400", ">700"]'
  data-eqio-prefix="media-object"
></div>

The above component will:

  • be able to be customised when its width is 400 or smaller ("<" is a synonym for max-width, not “less than”).
  • be able to be customised when its width is 700 or greater (">" is a synonym for min-width, not “greater than”).
  • apply the following classes media-object-eqio-<400 and media-object-eqio->700 as appropriate. If data-eqio-prefix had not been specified, the applied classes would be eqio-<400 and eqio->700.

Note: Multiple classes can be applied at once.

The CSS

In your CSS, write class names that match those applied to the HTML.

.media-object-eqio-\<400 {
  /* customizations when less than or equal to 400px */
}

.media-object-eqio-\>700 {
  /* customizations when greater than or equal to 700px */
}

Note:

  • eqio classes include the special characters < & >, so they must be escaped with a \ in your CSS.
  • eqio elements are position: relative by default, but your component can override that to absolute/fixed etc as required.
  • eqio elements can't be anything but overflow: visible.
  • To prevent accidental creation of horizontal scrollbars, a parent element is required to overflow-x: hidden. It is recommended to apply this to body.

The JavaScript

If using a module bundler, such as webpack, first import Eqio.

import Eqio from 'eqio';

In your JS, tell eqio which elements are to be made responsive by passing a DOM reference to Eqio.

var mediaObject = new Eqio(document.querySelector('.media-object'));

Should you need to stop this element from being responsive, you can call .stop() on your instance:

mediaObject.stop();

This will remove all observers and eqio internals, except for the class names that were applied at the time.


Copyright (c) 2018 Matt Stow
Licensed under the MIT license (see LICENSE for details)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].