GithubHelp home page GithubHelp logo

over-under's Introduction

Over-Under

Hide and show elements with media queries using class names

Add the class over[Number] or under[Number] to an element to only show it over or under a browser width.

This plugin saves the time of creating a new media query in the stylesheet just for hiding or showing an element at a certain window size.

It works by finding all classes over or under a number and creating a dymanic stylesheet with media queries to hide or show elements based on the browser width.

Since it uses a stylesheet to hide and show elements, there is no need to continually read the DOM as the window is resized.

Example

To show an element only when the browser is over 500 pixels wide...

<div class="over500">This only shows up when the window is over 500 pixels wide.</div>

To only show an element when the browser is over 500 pixels and under 800 pixels...

<div class="over500 under800">This only shows up when the window is over 500 pixels and under 800.</div>

How To

First, include the plugin in the head of your document (or at the end if you prefer).

<script type="text/javascript" src="js/overUnder.js"></script>

Then, call the plugin on $("body"). To ensure the plugin fires as early as possible, call it in a script block at the very end of your file, just before closing the body tag. You don't need to wrap this in a DOM ready function, as long as you put it at the very end of your html.

$("body").overUnder();

over-under's People

Contributors

drewbrolik avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

candemirci61

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.