This file contains hidden or 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
| // search for a DOM element every rendering frame until it exists | |
| // | |
| // borrowed from: | |
| // https://swizec.com/blog/how-to-properly-wait-for-dom-elements-to-show-up-in-modern-browsers/swizec/6663 | |
| function lookforelement() { | |
| if ( !$('.element').size() ) { | |
| window.requestAnimationFrame(lookforelement); | |
| } else { | |
| console.log('found element'); |
This file contains hidden or 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
| // determine "active" section as user scrolls | |
| var $sections = $('body section'); | |
| $window.scroll( function(e) { | |
| $.each($sections, function(i, el) { | |
| // measure the distance from the bottom of the element to the top of the viewport | |
| var offsetpadding = 100; // optional padding from top of viewport | |
| var sectionoffset = $(el).offset().top + $(el).outerHeight() - offsetpadding - $window.scrollTop(); |
This file contains hidden or 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
| div:nth-child(xn+y) { | |
| /* | |
| this evaluates like "x*n+y" | |
| x is cycle size | |
| n represents a counter, starting at 0 | |
| y is an offset | |
| */ | |
| } | |
| div:nth-child(3) { |
This file contains hidden or 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
| /* | |
| use x-shadow and y-shadow to apply style on a specific side | |
| blur == width of x or y value | |
| spread == negative of x or y value | |
| the below rule would apply style to all four sides of an element (in order: top, right, bottom, left) | |
| combine as desired to apply only to certain sides | |
| works best for inset shadows |
This file contains hidden or 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
| <meta http-equiv="cache-control" content="no-cache"> | |
| <meta http-equiv="pragma" content="no-cache"> | |
| <meta http-equiv="expires" content="-1"> |
This file contains hidden or 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
| var getparams = function(param) { | |
| var url = window.location.search.substring(1); | |
| var urlvars = url.split('&'); | |
| for (var i = 0; i < urlvars.length; i++) { | |
| var paramname = urlvars[i].split('='); | |
| if ( paramname[0] == param) { | |
| return paramname[1]; | |
| } | |
| } | |
| }; |
This file contains hidden or 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
| -webkit-font-smoothing: antialiased; |
This file contains hidden or 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
| div { | |
| position: relative; | |
| z-index: 1; | |
| } | |
| div:after { | |
| content: ''; | |
| position: absolute; | |
| z-index: -1; | |
| top: 0; |
This file contains hidden or 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
| $(document).ready(function() { | |
| // fire when the DOM is ready | |
| }); | |
| $(window).load(function() { | |
| // fire after page has been rendered | |
| }); | |
| $(window).unload(function() { | |
| // fire when user leaves the page |
NewerOlder