This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Nifty Animate | |
* Micro library to animate elements with CSS based on scroll position | |
* Requires: Lodash throttle & debounce | |
* Author: Franco Moya - @iamravenous | |
* Version: 1.1 Beta | |
*/ | |
const offset = el => { | |
const rect = el.getBoundingClientRect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin element($name) { | |
@at-root #{&}__#{$name}{ | |
@content; | |
} | |
} | |
@mixin modifier($name) { | |
@at-root #{&}--#{$name} { | |
@content; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Functions | |
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) { | |
$n: index($breakpoint-names, $name); | |
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null); | |
} | |
@function breakpoint-min($name, $breakpoints: $grid-breakpoints) { | |
$min: map-get($breakpoints, $name); | |
@return if($min !=0, $min, null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Sass mobile-first media queries mixins | |
* @author Franco Moya - @iamravenous | |
*/ | |
/* Breakpoints list map based on Bootstrap 4 grid */ | |
$breakpoints: ( | |
xs: 0, | |
sm: 544px, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Animation timing functions variables in Sass | |
* Based on Easings by Andrey Sitnik (Autoprefixer / PostCSS) and Matthew Lein's easing animation tool. | |
* Also used on Velocity.js animation library. | |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* http://easings.net/ | |
* https://matthewlein.com/ceaser | |
* http://velocityjs.org/ | |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Image as background | |
* Hide images and place as background-images | |
* Author: Franco Moya - @iamravenous | |
*/ | |
document.addEventListener("DOMNodeInserted", function() { | |
var imgSrc = document.querySelectorAll("[data-img-src]"); | |
for (var i = 0; i < imgSrc.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Format Numbers | |
* A handy and fast way to format numbers as currency | |
* Author: Franco Moya - @iamravenous | |
* Version: 0.1.1 | |
*/ | |
function formatNumbers(value) { | |
var a = value.toString(); | |
var b = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Highlight Element | |
* Highlight element on hover and fade all the same elements, except the current | |
* Recommended for use in galleries or in grids with many items or cards | |
* Author: Franco Moya - @iamravenous | |
*/ | |
var highlight = $('.grid-item'); | |
highlight.hover ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Smooth scroll to top | |
* Easy and reusable script for smoothing scroll to top | |
* Author: Franco Moya - @iamravenous | |
* Usage: Add data-scroll="top" to the link or element you want to scroll to top | |
*/ | |
$('[data-scroll="top"]').click(function(e){ | |
e.preventDefault(); | |
$('body,html').animate({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Smooth scroll to anchor link | |
* Automatically detects the hash and scroll smoothly to anchor link with URL hashchange | |
* Author: Franco Moya - @iamravenous | |
*/ | |
// If you need more autonomy, | |
// You can replace hash detection with a data-attribute | |
// e.g. $("[data-scroll='smooth']") |
NewerOlder