GithubHelp home page GithubHelp logo

appendaround's Introduction

⚠️ This project is archived and the repository is no longer maintained.

AppendAround

A pattern for responsive markup

  • © 2012, @scottjehl, Filament Group, Inc. MIT/GPL

How To

  1. Insert potential element containers throughout the DOM
  2. give each container a data-set attribute with a value that matches all other containers' values
  3. Place your appendAround content in one of the potential containers
  4. Configure your CSS to only display one potential container at a time (and display others depending on @media conditions in your CSS)
  5. Call appendAround() on that element when the DOM is ready, and it'll keep itself in a visibile container at all times

Sample markup

<!-- potential container for appendAround -->
<div class="foo" data-set="foobarbaz"></div>

<ul>
	<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
	<li>Aliquam tincidunt mauris eu risus.</li>
	<li>Vestibulum auctor dapibus neque.</li>
</ul>

<!-- potential container for appendAround -->
<div class="bar" data-set="foobarbaz"></div>

<ul>
	<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
	<li>Aliquam tincidunt mauris eu risus.</li>
	<li>Vestibulum auctor dapibus neque.</li>
</ul>

<!-- initial container for appendAround -->
<div class="baz" data-set="foobarbaz">
	<p class="sample">Sample appendAround Element</p>
</div>

Sample CSS

/* the sample appendaround element */
.sample {
	padding: 1em;
	background: tan;
}

.baz {
	display: block;
}
.foo,
.bar {
	display: none; 
}

@media (min-width: 30em){
	.bar {
		display: block;
	}
	.foo, .baz {
		display: none; 
	}
}

@media (min-width: 50em){
	div.foo {
		display: block;
	}
	div.bar, div.baz {
		display: none; 
	}
}

Sample JavaScript call

$( ".sample" ).appendAround();

appendaround's People

Contributors

jefflembeck avatar johnbender avatar scottjehl avatar zachleat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appendaround's Issues

Bower package

I could not find a bower package for this script. It would be handy to have one. I can help with registering one.

Add git tags and check the version

I would like to add this library via send pull request to cdnjs project.
The git auto-updater rely on git tags to recognize the correct version, so please add git tags and check the versions.
Thank you.

cdnjs/cdnjs#7027

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.