Skip to content

Instantly share code, notes, and snippets.

@bookwyrm
Created April 1, 2015 13:29
Show Gist options
  • Save bookwyrm/bd62a14812fba177497c to your computer and use it in GitHub Desktop.
Save bookwyrm/bd62a14812fba177497c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
%div.container
%span.with-js JS is available
%span.without-js JS is not available
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
@mixin js--enabled() {
@at-root html.js #{&} {
@content;
}
}
@mixin js--disabled() {
@at-root html.no-js #{&} {
@content
}
}
.container {
.with-js, .without-js {
display: none;
}
@include js--enabled() {
.with-js {
display: block;
}
}
@include js--disabled() {
.without-js {
display: block;
}
}
}
.container .with-js, .container .without-js {
display: none;
}
html.js .container .with-js {
display: block;
}
html.no-js .container .without-js {
display: block;
}
<div class='container'>
<span class='with-js'>JS is available</span>
<span class='without-js'>JS is not available</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment