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 toggleClass(element, className) { | |
var newClass = ' ' + element.className.replace( /[\t\r\n]/g, ' ' ) + ' '; | |
if(hasClass(element, className)) { | |
while(newClass.indexOf(' ' + className + ' ') >= 0) { | |
newClass = newClass.replace(' ' + className + ' ' , ' '); | |
} | |
element.className = newClass.replace(/^\s+|\s+$/g, ''); | |
} else { | |
element.className += ' ' + className; | |
} |
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 removeClass(element, className) { | |
var newClass = ' ' + element.className.replace( /[\t\r\n]/g, ' ') + ' '; | |
if(hasClass(element, className)) { | |
while(newClass.indexOf(' ' + className + ' ') >= 0) { | |
newClass = newClass.replace(' ' + className + ' ', ' '); | |
} | |
element.className = newClass.replace(/^\s+|\s+$/g, ''); | |
} | |
} |
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 addClass(element, className) { | |
if(!hasClass(element, className)) { | |
element.className += ' ' + className; | |
} | |
} |
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 hasClass(element, className) { | |
return new RegExp(' ' + className + ' ').test(' ' + element.className + ' '); | |
} |
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
// Given a variable 'elements', which contains a Node List of HTML elements | |
for ( var i = 0; i < elements.length; i++ ) { | |
var self = elements[i]; | |
// Do stuff with element | |
self.doStuff(); | |
} |
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
To change font format | |
--------------------- | |
Moment.js must be included before pikaday.js, else Pikaday will go into stand-alone mode when it runs. | |
Examples | |
-------- |
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
@-moz-document url-prefix() { | |
.selector { | |
color: #c00; | |
} | |
} |
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
%clearfix { | |
*zoom: 1; | |
&:before, &:after { | |
content: " "; | |
display: table; | |
} | |
&:after { | |
clear: both; | |
} | |
} |
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
FB.init({ | |
appId: '383046638449372', | |
status: true, | |
cookie: true, | |
xfbml: true | |
}); | |
FB.Canvas.setSize({ height: 600 }); | |
setTimeout('FB.Canvas.setAutoGrow()', 500); | |
FB.Canvas.scrollTo(0,0); |
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
.opacity-class{ | |
-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=50); // IE8 | |
filter:alpha(opacity=50); // IE5-7 | |
-moz-opacity:0.5; // Netscape | |
-khtml-opacity:0.5; // Safari 1.x | |
opacity:0.5; // Good browsers | |
} |
NewerOlder