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
// Traverse through all properties, including nested, in an object. | |
var obj = { | |
one: 1, | |
two: 'two', | |
three: [1,2,3], | |
four: { | |
four1: 1, | |
four2: true, | |
four3: { |
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
// Class for equalizing heights of elements. Works on window resize. | |
// Example usage: | |
// var instanceObject = Object.create(equalizeHeightsWithResize); | |
// instanceObject.selector = '.srp-prod h3'; | |
// instanceObject.eq(); | |
var equalizeHeightsWithResize = { | |
max: 0, | |
rt: null, | |
selector: '', | |
eq: function() { |
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
/*\ | |
|*| | |
|*| :: cookies.js :: | |
|*| | |
|*| A complete cookies reader/writer framework with full unicode support. | |
|*| | |
|*| Revision #1 - September 4, 2014 | |
|*| | |
|*| https://developer.mozilla.org/en-US/docs/Web/API/document.cookie |
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
// A function to equalize heights of all elements matching the selector. | |
// Example Usage: | |
// equalizeHeights( '.allTestimonialTextBlocks' ); | |
function equalizeHeights( selector ) { | |
var max = 0; | |
var current; | |
$( selector ).css( 'min-height', 'inherit' ); | |
$( selector ).each( function( i, v ) { | |
current = parseInt( $( v ).css( 'height' )); | |
current > max ? max = current : max = max; |
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
/* | |
Author: Aniket A. Suryavanshi | @44Sur | |
Gist URL: https://gist.github.com/anikets/b8dd21a374aebc1f1f37 | |
A handy jQuery plugin to scroll an element to top of screen. | |
Example usage: | |
$( '#selector' ).scrollHere(); | |
$( '#selector' ).scrollHere( 45 ); | |
$( '#selector' ).scrollHere( $( '.header' ).height()); |
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
/* | |
* Author: Aniket A. Suryavanshi | @44Sur | |
* Gist URL: https://gist.github.com/anikets/2da2fb7ac318c2f507a7 | |
* | |
* Some mixins for quickly writing less bloated cross-browser CSS. | |
* | |
* Setup instructions: | |
* Save this file with a .scss extension. Import this file in the .scss file | |
* in which you wish to use these mixins by adding this directive at the top: | |
* @import 'css3-scss-mixins'; |
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
/* | |
* Author: Aniket A. Suryavanshi | @44Sur | |
* Gist URL: https://gist.github.com/anikets/2da2fb7ac318c2f507a7 | |
* | |
* Some mixins for quickly writing less bloated cross-browser CSS. | |
* | |
* Setup instructions: | |
* Save this file with a .scss extension. Import this file in the .scss file | |
* in which you wish to use these mixins by adding this directive at the top: | |
* @import 'css3-scss-mixins'; |
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 xc, yc; // X and Y coordinates of the mouse pointer. | |
// Change perspective origin as the mouse pointer moves. | |
document.body.addEventListener( 'mousemove', function( event ) { | |
// Chrome returns event.x and event.y whereas Firefox returns | |
// eventclientX and eventClientY. | |
'x' in event ? xc = event.x : xc = event.clientX; | |
'y' in event ? yc = event.y : yc = event.clientY; | |
document.body.setAttribute('style', 'perspective-origin:' + xc + 'px ' + yc + 'px;' + '-webkit-perspective-origin-x:' + xc + 'px; -webkit-perspective-origin-y:' + yc + 'px' ); | |
}); |
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
body { | |
perspective: 1000px; | |
-webkit-perspective: 1000px; | |
} | |
.window { | |
background-image: url( 'images/waterscape.JPG' ); | |
background-position: center center; | |
background-size: cover; | |
border: solid 50px brown; | |
border-image: url('images/dark_wood.png') 25% repeat; |
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 class='window'> | |
<div class='pane'>Pane 1</div class='pane'> | |
<div class='pane'>Pane 2</div class='pane'> | |
<div class='pane'>Pane 3</div class='pane'> | |
<div class='pane'>Pane 4</div class='pane'> | |
<div class='pane'>Pane 5</div class='pane'> | |
</div> |