Created by James Vivian / @jvivs
Now for all shapes and sizes.
$screen: "only screen";
$small: "only screen and (min-width:"#{$small-screen}")";
$medium: "only screen and (min-width:"#{$medium-screen}")";
$large: "only screen and (min-width:"#{$large-screen}")";
$landscape: "only screen and (orientation: landscape)";
$portrait: "only screen and (orientation: portrait)";
$small-screen: emCalc(768);
12 columns instead of 4
$medium-screen: emCalc(1280);
Separate medium grids enable a design to respond with finesse.
*planned for v5, early release included in v4.3
$large-screen: emCalc(1440);
Have lots of real estate? Take advantage!
Mix and match.
&.active,
&:active {
// prevent underline in firefox
text-decoration: none;
.icon {
opacity: .6;
}
}
&.open {
.icon {
color: $mainColor !important;
opacity: 1;
}
}
// reset button corners if necessary
&.square {
@include border-radius(0);
}
/* Sizes */
&.large {
font-size: 15px;
padding: 7px 16px 6px;
.icon.oversized.icon-append {
margin: 2px -6px -1px 3px;
}
}
/* Colors */
// style is the same for all of these, so print them on one line to prevent repetition
&.primary,
&.success,
&.alert,
&.secondary,
&.gradient {
border: 0;
&:hover {
border: 0;
}
}
// darken background color (no transition), keep all shadows the same
@each $button-type in $button-types {
$type: nth($button-type, 1);
$color: nth($button-type, 2);
$active-color: nth($button-type, 3);
@if ($type == '.primary') {
@include button-colors($color, nth($active-color, 1), nth($active-color, 2));
}
{$type} {
@include button-colors($color, nth($active-color, 1), nth($active-color, 2));
}
}
// sharpen white-text on red bg
&.alert {
@include sharp-text($white);
}
// dark text on light background
&.secondary {
color: $btn-secondary-text-color;
.icon {
color: $black;
}
@include box-shadow(0 1px 0 darken($btnSecondaryColor, 15%), 0 0 1px transparentize(darken($btnSecondaryColor, 35%), .2), 0 1px 1px transparentize(darken($btnSecondaryColor, 25%), .2));
// light text on dark background
&.active,
&:active {
color: $white;
.icon {
color: $white;
}
}
// outer glow on :focus
&:focus {
@include box-shadow(0 1px 0 darken($btnSecondaryColor, 15%), 0 0 1px transparentize(darken($btnSecondaryColor, 25%), .2), 0 0 5px opacify($btn-secondary-text-color, 0.5));
}
}
// transperent button (on dark bg)
&.transparent {
background-color: transparent;
@include box-shadow(none);
color: $txtColor;
.icon {
color: $black;
&.icon-white {
color: $white;
}
}
&.on-dark {
@include sharp-text(darken($white, 20%));
.icon {
color: $white;
}
&:hover,
&.active,
&:active {
color: white;
background-color: transparent;
@include box-shadow(none);
}
}
}
&.gradient {
@include background-image(linear-gradient(top, #fbfbfb, #e5e5e5));
color: $btnGradientColor;
background-color: transparent;
@include box-shadow(none);
&, &:hover {
border: 1px $imageBorderColor solid;
}
.icon {
opacity: 1;
color: $btnGradientColor;
}
}
// We use this to quickly create buttons with a single mixin. As @jaredhardy puts it, "the kitchen sink mixin"
@mixin button($padding:$button-med, $bg:$primary-color, $radius:false, $full-width:false, $disabled:false, $is-input:false, $is-prefix:false) {
@include button-base;
@include button-size($padding, $full-width, $is-input);
@include button-style($bg, $radius, $disabled);
}
$('.some-dropdown-element').on('click', function () {
e.stopPropagation()
// do the rest of your stuff here
});
Dropdowns have been rewritten and are now easier to style, and easier to handle with javascript.
Has Dropdown
Has Content Dropdown
data-interchange="[image_path, (media query)], [image_path, (media query)]"
$(document).foundation('interchange', {
named_queries : {
my_custom_query : 'only screen and (max-width: 200px)'
}
});
(pixel-density is a media query too!)
$(document).on('replace', 'img', function (e, new_path, original_path) {
// replace handler
});
$(document).foundation('interchange', 'reflow');
Mobile first (I tested). Create workflows with linked modals.
Built as a mixin, customization-ready.
HTML5 form validation
Pretty! And Free!
9.7k vs 32k
(famous last words)
$(document).foundation();
jvivs @ {octo + bird}