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
/** | |
* From:http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/ | |
*/ | |
/** basic css | |
* @see Set margin -> 'auto',position -> absolute. | |
* And t,l,b,r to a defined value. | |
* .center{ | |
* margin: auto; |
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
/** | |
* | |
* Selector Hacks | |
* | |
**/ | |
/* IE6 and below */ | |
* html #uno { color: red } | |
/* IE7 */ | |
*:first-child+html #dos { color: red } |
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
// use jQuery | |
function htmlEncode(value){ | |
//create a in-memory div, set it's inner text(which jQuery automatically encodes) | |
//then grab the encoded contents back out. The div never exists on the page. | |
return $('<div/>').text(value).html(); | |
} | |
function htmlDecode(value){ | |
return $('<div/>').html(value).text(); |
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
function QueryStringToJSON() { | |
var pairs = location.search.slice(1).split('&'); | |
var result = {}; | |
pairs.forEach(function(pair) { | |
pair = pair.split('='); | |
result[pair[0]] = decodeURIComponent(pair[1] || ''); | |
}); | |
return JSON.parse(JSON.stringify(result)); |
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
jQuery('form').submit(function() { | |
jQuery(window).unbind("beforeunload"); | |
... | |
}); |
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
function getCookie( name ) { | |
var parts = document.cookie.split(name + "="); | |
if (parts.length == 2) return parts.pop().split(";").shift(); | |
} | |
function expireCookie( cName ) { | |
document.cookie = | |
encodeURIComponent( cName ) + | |
"=deleted; expires=" + | |
new Date( 0 ).toUTCString(); |
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
//IE VERSION CONTROL | |
function getInternetExplorerVersion() { | |
// Return value assumes failure. | |
var rv = -1; | |
if (navigator.appName == 'Microsoft Internet Explorer') { | |
var ua = navigator.userAgent; | |
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) rv = parseFloat(RegExp.$1); | |
} |
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
var cuisines = ["Chinese","Indian"]; | |
var sel = document.getElementById('CuisineList'); | |
for(var i = 0; i < cuisines.length; i++) { | |
var opt = document.createElement('option'); | |
opt.innerHTML = cuisines[i]; | |
opt.value = cuisines[i]; | |
sel.appendChild(opt); | |
} | |
//demo:http://jsfiddle.net/jackwanders/kGgkE/ |
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
svg { | |
display: block; | |
margin: 50px auto; | |
} | |
#loader | |
{ | |
fill: #0088cc; | |
} |
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
#anim.enable | |
{ | |
-webkit-animation: flash 1s ease 3; | |
-moz-animation: flash 1s ease 3; | |
-ms-animation: flash 1s ease 3; | |
-o-animation: flash 1s ease 3; | |
animation: flash 1s ease 3; | |
} | |
/* animation */ |
OlderNewer