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
$services.on('click','.sub-columns a',function(){ | |
// stuff | |
}); | |
$someVariable.on('someevent','.classtarget',function(){ | |
// stuff | |
}); | |
// used for targeting specific events & classes | |
// more optimal than a dom crawl |
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
/* ##### General Tips & Syntax ##### */ | |
// scope | |
var area = 36; // a var with global scope | |
var volume = function (w, l, h) { | |
var depth = 15; // a var with local scope | |
area = w * l; // a var with global scope | |
}; | |
// line wrap |
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
// Psuedo: | |
(some_condition) ? do_something_simple : do_something_else; | |
// Example within an API | |
$('.featured-carousel .carousel').carouFredSel({ | |
scroll: { | |
fx: ($('html').hasClass('ie8'))?'scroll':'crossfade' | |
} | |
}); |
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
// >> jQuery - select all element multiples, beyond the ones you want to retain >>>>>>>>>>>>>>>> | |
$('.someElement').find('ul li+li').hide(); | |
// li+li+li | |
// li+li+li+li, etc | |
// same syntax as css |
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
(function ($) { | |
/** | |
* @function | |
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM | |
* @param {function} handler A function to execute at the time when the element is inserted | |
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation | |
* @example $(selector).waitUntilExists(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
// Stock Android Browser Check >>>>>>>>>>>>>>>> | |
var ua = navigator.userAgent.toLowerCase(); | |
var isAndroid = ua.indexOf("android") > -1 && ua.indexOf("mobile") && ua.indexOf("chrome")==-1 | |
if(isAndroid) { | |
// stuff | |
} |
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
1) edit the file as needed and back it up somewhere | |
2) physically delete the file in question (not the backup) | |
3) edit .gitignore and add path/filename.file | |
4) remove the file from git using git rm filename.file | |
5) git add / commit the change | |
6) copy / paste the backup back into the source folder | |
7) git status - if done correctly, git will no longer pick up the file | |
// this issue typically happens when you add a file to .gitignore after the file has already been checked in |
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
// jquery >> Responsive Colorbox >>>>>>>>>>>>>>>> | |
(function($){ | |
// -- ColorBox Init -------------------------------------------------------------------------------------------------- | |
var resizeTimer, ct, winWidth = $(window).width(); | |
// | |
$(window).resize(function(){ | |
if (resizeTimer) ct = clearTimeout(resizeTimer); | |
resizeTimer = window.setTimeout(function() { | |
if ($('#cboxOverlay').is(':visible')) { |
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-transform: translate(-50%,-50%); | |
/* position:relative; top:0; Left:0; | |
margin: 0 0 0 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
// jquery >> Scroll Check >>>>>>>>>>>>>>>> | |
// prereq: debounce: https://github.com/cowboy/jquery-throttle-debounce | |
$(window).scroll($.debounce( 250, true, function(){ // +++ if scrolling | |
// do something | |
})); | |
$(window).scroll($.debounce( 250, function(){ // +++ if not... | |
// do something else | |
})); |