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
// --------- keyboard navigation control --------- // | |
var isinmotion = false; | |
$j(document).keydown(function(e){ | |
switch (e.keyCode) { | |
case 38: | |
//console.log("up"); | |
if (isinmotion) { | |
return false; | |
} else { | |
var curr = $j("li.viewing:last"); |
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
// --------- keyboard navigation control --------- // | |
var isinmotion = false; | |
$j(document).keydown(function(e){ | |
switch (e.keyCode) { | |
case 38: | |
//console.log("up"); | |
if (isinmotion) { | |
return false; | |
} else { | |
var curr = $j("li.viewing:last"); |
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
window.onresize = function(e) { | |
delay(function(){ | |
// do something..... | |
}, 250); | |
} | |
var delay = (function(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout (timer); |
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 backgroundPos, | |
xPos, | |
yPos; | |
if( $j("html").hasClass("ie8")) { // html class... you know... it's useful | |
xPos = $j(this).css("background-position-x"); | |
yPos = Number($j(this).css("background-position-y").replace(/[^0-9-]/g, '')); | |
} else { | |
backgroundPos = $j(this).css("backgroundPosition").split(" "); | |
xPos = backgroundPos[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
isMobile: function() { | |
// detect user agent | |
var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); | |
var result = false; | |
if (mobile) { | |
result = true; | |
var userAgent = navigator.userAgent.toLowerCase(); | |
if ((userAgent.search("android") > -1) && (userAgent.search("mobile") > -1)) | |
result = true; // android mobile |
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
setCookie: function(name,value,days) { | |
if (days) { | |
var date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
var expires = "; expires="+date.toGMTString(); | |
} | |
else var expires = ""; | |
document.cookie = name+"="+value+expires+"; path=/"; | |
}, |
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
// iPad Orientation and scale , ref: http://adactio.com/journal/4470/ | |
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) { | |
var viewportmeta = document.querySelector('meta[name="viewport"]'); | |
if (viewportmeta) { | |
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0'; | |
document.body.addEventListener('gesturestart', function () { | |
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6'; | |
}, false); | |
} | |
} |
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
Namespace |
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 dropdowns = { | |
className1: 'classname1', | |
className2: 'classname2', | |
className3: 'classname3' | |
}; | |
for(index in dropdowns) { | |
if( dropdowns[index] != currentClass) { | |
$j('.' + dropdowns[index]).dosomething(); | |
} |
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
// Form - Placeholder | |
if(!Modernizr.input.placeholder) { | |
//alert("no placeholder!!!!!"); | |
$j("*:text:not([type='password'])").each(function(){ | |
//$j(this).css("border","solid 1px red"); | |
if( $j(this).attr("placeholder") && $j(this).attr("placeholder").length > 1 ) { | |
var placeholderTxt = $j(this).attr("placeholder"); | |
$j(this).val(placeholderTxt); |