Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fg-appendaround

Package Overview
Dependencies
Maintainers
6
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fg-appendaround

A pattern for responsive markup

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

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

Demo

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();

FAQs

Package last updated on 27 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc