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
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html | |
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/ | |
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
// Scroll to specific values | |
// scrollTo is the same | |
window.scroll({ | |
top: 2500, | |
left: 0, | |
behavior: 'smooth' | |
}); | |
// Scroll certain amounts from current position | |
window.scrollBy({ |
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 labelID; | |
$('label').click(function() { | |
labelID = $(this).attr('for'); | |
$('#'+labelID).trigger('click'); | |
}); | |
//All browsers except IE will do this when you code it this way below: | |
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
//using async loading | |
// Only do anything if jQuery isn't defined | |
if (typeof jQuery == 'undefined') { | |
if (typeof $ == 'function') { | |
// warning, global var | |
thisPageUsingOtherJSLibrary = true; | |
} | |
function getScript(url, success) { |
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 kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
$(document).keydown(function(e) { | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
$(document).unbind('keydown',arguments.callee); | |
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(){ | |
$("a").each(function(){ | |
if ($(this).attr("href") == window.location.pathname){ | |
$(this).addClass("selected"); | |
} | |
}); | |
}); |
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
<!DOCTYPE html> | |
<html class="no-js"> | |
<head> | |
<meta charset='UTF-8'> | |
<title>Simple Loader</title> | |
<style> | |
/* This only works with JavaScript, |
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
if ( $('#myElement').length ) { | |
// it exists | |
} | |
//>0 was not required | |
//if ($('#myElement').length > 0) { | |
// it exists | |
}// |